Return full URLs in review serializer for both post and topic
Return full URLs, this fixes reviewable links to support subfolder
This commit is contained in:
parent
3b16eb7abb
commit
786fcceb62
|
@ -106,7 +106,7 @@ class ReviewableSerializer < ApplicationSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def target_url
|
def target_url
|
||||||
return object.target.url if object.target.is_a?(Post) && object.target.present?
|
return Discourse.base_url + object.target.url if object.target.is_a?(Post) && object.target.present?
|
||||||
topic_url
|
topic_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ describe ReviewableSerializer do
|
||||||
it "links to the flagged post" do
|
it "links to the flagged post" do
|
||||||
fp = Fabricate(:reviewable_flagged_post)
|
fp = Fabricate(:reviewable_flagged_post)
|
||||||
json = described_class.new(fp, scope: Guardian.new(admin), root: nil).as_json
|
json = described_class.new(fp, scope: Guardian.new(admin), root: nil).as_json
|
||||||
expect(json[:target_url]).to eq(fp.post.url)
|
expect(json[:target_url]).to eq(Discourse.base_url + fp.post.url)
|
||||||
expect(json[:topic_url]).to eq(fp.topic.url)
|
expect(json[:topic_url]).to eq(fp.topic.url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue