Show link to the original topic when it was deleted (#7319)

* Moved i18n keys to core. We show a links that points to the original topic when it was deleted

* Use link-to since it's more idiomatic
This commit is contained in:
Roman Rizzi
2019-04-10 06:25:45 -03:00
committed by Régis Hanol
parent b5008586c5
commit 82e051077d
4 changed files with 27 additions and 14 deletions

View File

@@ -72,19 +72,19 @@ class ReviewableSerializer < ApplicationSerializer
end
def attributes
data = super
super.tap do |data|
data[:removed_topic_id] = object.topic_id unless object.topic
if object.target.present?
# Automatically add the target id as a "good name" for example a target_type of `User`
# becomes `user_id`
data[:"#{object.target_type.downcase}_id"] = object.target_id
if object.target.present?
# Automatically add the target id as a "good name" for example a target_type of `User`
# becomes `user_id`
data[:"#{object.target_type.downcase}_id"] = object.target_id
end
if self.class._payload_for_serialization.present?
data[:payload] = (object.payload || {}).slice(*self.class._payload_for_serialization)
end
end
if self.class._payload_for_serialization.present?
data[:payload] = (object.payload || {}).slice(*self.class._payload_for_serialization)
end
data
end
def topic_tags