14 lines
351 B
Ruby
Raw Normal View History

class DiscourseChat::RuleSerializer < ApplicationSerializer
attributes :id, :channel_id, :type, :group_id, :group_name, :category_id, :tags, :filter
2017-07-28 20:27:49 +01:00
def group_name
if object.group_id
2017-09-28 16:32:38 +08:00
if group = Group.find_by(id: object.group_id)
group.name
2017-07-28 20:27:49 +01:00
else
2017-09-28 16:32:38 +08:00
I18n.t("chat_integration.deleted_group")
2017-07-28 20:27:49 +01:00
end
end
end
2017-08-01 20:53:39 +01:00
end