FIX: In reply to would sometimes have a broken link

This commit is contained in:
Robin Ward
2019-06-10 11:33:10 -04:00
parent 5d7e34e0ad
commit 8c4e16eafd
3 changed files with 38 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ class ReviewableSerializer < ApplicationSerializer
:type,
:topic_id,
:topic_url,
:target_url,
:topic_tags,
:category_id,
:created_at,
@@ -107,13 +108,21 @@ class ReviewableSerializer < ApplicationSerializer
object.topic.present? && SiteSetting.tagging_enabled?
end
def target_url
return object.target.url if object.target.is_a?(Post) && object.target.present?
topic_url
end
def include_target_url?
target_url.present?
end
def topic_url
return object.target.url if object.target.is_a?(Post)
return object.topic.url
return object.topic&.url
end
def include_topic_url?
object.topic.present?
topic_url.present?
end
def include_topic_id?