2017-07-18 11:17:03 -04:00
|
|
|
class DiscourseChat::RuleSerializer < ApplicationSerializer
|
2017-08-01 10:20:00 -04:00
|
|
|
attributes :id, :channel_id, :type, :group_id, :group_name, :category_id, :tags, :filter
|
2017-07-28 15:27:49 -04:00
|
|
|
|
|
|
|
def group_name
|
|
|
|
if object.group_id
|
2017-08-01 15:53:39 -04:00
|
|
|
groups = Group.where(id: object.group_id)
|
2017-07-28 15:27:49 -04:00
|
|
|
if groups.exists?
|
|
|
|
return groups.first.name
|
|
|
|
else
|
|
|
|
return I18n.t("chat_integration.deleted_group")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-08-01 15:53:39 -04:00
|
|
|
end
|