discourse/plugins/chat/app/serializers/direct_message_channel_seri...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
354 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class DirectMessageChannelSerializer < ApplicationSerializer
has_many :users, serializer: UserWithCustomFieldsAndStatusSerializer, embed: :objects
def users
users = object.direct_message_users.map(&:user).map { |u| u || DeletedChatUser.new }
return users - [scope.user] if users.count > 1
users
end
end