Files
discourse/plugins/chat/app/serializers/chat/reviewable_message_serializer.rb
Ted Johansson d1253bc3af DEV: Include context question for chat reviewables (#23332)
Chat review queue flags were missing the context message above the actions.

This is probably because the (reasonably complex) logic was somewhat hard-coded to posts. After some investigation I concluded we can reuse this logic with some small amendments.
2023-09-05 10:11:39 +08:00

26 lines
534 B
Ruby

# frozen_string_literal: true
require_dependency "reviewable_serializer"
module Chat
class ReviewableMessageSerializer < ReviewableSerializer
target_attributes :cooked
payload_attributes :transcript_topic_id, :message_cooked
attributes :target_id
has_one :chat_channel, serializer: Chat::ChannelSerializer, root: false, embed: :objects
def created_from_flag?
true
end
def chat_channel
object.chat_message.chat_channel
end
def target_id
object.target&.id
end
end
end