From 786fcceb622f591e15d85410b0659f09e267decf Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Thu, 14 Nov 2019 15:57:24 -0800 Subject: [PATCH] Return full URLs in review serializer for both post and topic Return full URLs, this fixes reviewable links to support subfolder --- app/serializers/reviewable_serializer.rb | 2 +- spec/serializers/reviewable_serializer_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/serializers/reviewable_serializer.rb b/app/serializers/reviewable_serializer.rb index 19c56d330c5..af03419d2a1 100644 --- a/app/serializers/reviewable_serializer.rb +++ b/app/serializers/reviewable_serializer.rb @@ -106,7 +106,7 @@ class ReviewableSerializer < ApplicationSerializer end 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 end diff --git a/spec/serializers/reviewable_serializer_spec.rb b/spec/serializers/reviewable_serializer_spec.rb index 8c2e95f1569..ccce5182bf1 100644 --- a/spec/serializers/reviewable_serializer_spec.rb +++ b/spec/serializers/reviewable_serializer_spec.rb @@ -37,7 +37,7 @@ describe ReviewableSerializer do it "links to the flagged post" do fp = Fabricate(:reviewable_flagged_post) 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) end