mirror of
https://github.com/discourse/discourse.git
synced 2025-03-02 09:19:22 +00:00
This is a followup of the previous refactor where we created two new models to handle all the dedicated logic that was present in the `ChatChannel` model. For the sake of consistency, `DMChannel` has been renamed to `DirectMessageChannel` and the previous `DirectMessageChannel` model is now named `DirectMessage`. This should help reasoning about direct messages.
22 lines
348 B
Ruby
22 lines
348 B
Ruby
# frozen_string_literal: true
|
|
|
|
class DirectMessageChannel < ChatChannel
|
|
alias_attribute :direct_message, :chatable
|
|
|
|
def direct_message_channel?
|
|
true
|
|
end
|
|
|
|
def allowed_user_ids
|
|
direct_message.user_ids
|
|
end
|
|
|
|
def read_restricted?
|
|
true
|
|
end
|
|
|
|
def title(user)
|
|
direct_message.chat_channel_title_for_user(self, user)
|
|
end
|
|
end
|