{{{reviewable.cooked}}}
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs
index 5c5279a05fa..5cf27df252c 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs
@@ -3,7 +3,7 @@
{{reviewable-created-by-name user=reviewable.created_by tagName=''}}
- {{#reviewable-topic-link topic=reviewable.topic}}
+ {{#reviewable-topic-link reviewable=reviewable}}
{{i18n "review.new_topic"}}
{{reviewable.payload.title}}
{{/reviewable-topic-link}}
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-topic-link.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-topic-link.hbs
index d13f72a37f0..f19fc01dd80 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-topic-link.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-topic-link.hbs
@@ -1,14 +1,12 @@
-{{#if topic}}
-
- {{#if topic}}
- {{i18n "review.topic"}}
- {{topic-status topic=topic}}
- {{topic-link topic}}
- {{i18n "review.topic_replies" count=topic.reply_count}}
- {{else}}
- {{yield}}
- {{/if}}
-
-{{else}}
- {{i18n "topic.deleted"}}
-{{/if}}
+
+ {{#if reviewable.topic}}
+ {{i18n "review.topic"}}
+ {{topic-status topic=reviewable.topic}}
+ {{reviewable.topic.title}}
+ {{i18n "review.topic_replies" count=reviewable.topic.reply_count}}
+ {{else if (has-block)}}
+ {{yield}}
+ {{else}}
+ {{i18n "topic.deleted"}}
+ {{/if}}
+
diff --git a/app/serializers/reviewable_serializer.rb b/app/serializers/reviewable_serializer.rb
index 36e0e6f1245..f6d3f233349 100644
--- a/app/serializers/reviewable_serializer.rb
+++ b/app/serializers/reviewable_serializer.rb
@@ -10,6 +10,7 @@ class ReviewableSerializer < ApplicationSerializer
:status,
:type,
:topic_id,
+ :topic_url,
:category_id,
:created_at,
:can_edit,
@@ -86,6 +87,15 @@ class ReviewableSerializer < ApplicationSerializer
data
end
+ def topic_url
+ return object.target.url if object.target.is_a?(Post)
+ return object.topic.url
+ end
+
+ def include_topic_url?
+ object.topic_id.present?
+ end
+
def include_topic_id?
object.topic_id.present?
end
diff --git a/spec/serializers/reviewable_flagged_post_serializer_spec.rb b/spec/serializers/reviewable_flagged_post_serializer_spec.rb
new file mode 100644
index 00000000000..1165fe18039
--- /dev/null
+++ b/spec/serializers/reviewable_flagged_post_serializer_spec.rb
@@ -0,0 +1,16 @@
+require 'rails_helper'
+
+describe ReviewableFlaggedPostSerializer do
+
+ let(:admin) { Fabricate(:admin) }
+
+ it "includes the user fields for review" do
+ p0 = Fabricate(:post)
+ reviewable = PostActionCreator.spam(Fabricate(:user), p0).reviewable
+ json = ReviewableFlaggedPostSerializer.new(reviewable, scope: Guardian.new(admin), root: nil).as_json
+ expect(json[:cooked]).to be_present
+ expect(json[:raw]).to be_present
+ expect(json[:topic_url]).to eq(p0.url)
+ end
+
+end
diff --git a/spec/serializers/reviewable_queued_post_serializer_spec.rb b/spec/serializers/reviewable_queued_post_serializer_spec.rb
index 11bc89964f8..6e18817d881 100644
--- a/spec/serializers/reviewable_queued_post_serializer_spec.rb
+++ b/spec/serializers/reviewable_queued_post_serializer_spec.rb
@@ -48,6 +48,7 @@ describe ReviewableQueuedPostSerializer do
expect(payload['raw']).to eq('hello world post contents.')
expect(payload['title']).to be_blank
expect(json[:topic_id]).to eq(reviewable.topic_id)
+ expect(json[:topic_url]).to eq(reviewable.topic.url)
expect(json[:can_edit]).to eq(true)
fields = json[:editable_fields]
diff --git a/spec/serializers/reviewable_user_serializer_spec.rb b/spec/serializers/reviewable_user_serializer_spec.rb
index 8e6a63e51a9..5b117d01473 100644
--- a/spec/serializers/reviewable_user_serializer_spec.rb
+++ b/spec/serializers/reviewable_user_serializer_spec.rb
@@ -11,6 +11,7 @@ describe ReviewableUserSerializer do
expect(json[:username]).to eq(reviewable.target.username)
expect(json[:email]).to eq(reviewable.target.email)
expect(json[:name]).to eq(reviewable.target.name)
+ expect(json[:topic_url]).to be_blank
end
end