2022-11-02 21:41:30 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-11-02 22:53:36 +08:00
|
|
|
class DirectMessageChannel < ChatChannel
|
|
|
|
alias_attribute :direct_message, :chatable
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2022-11-02 22:53:36 +08:00
|
|
|
def direct_message_channel?
|
|
|
|
true
|
2022-11-02 21:41:30 +08:00
|
|
|
end
|
|
|
|
|
2022-11-02 22:53:36 +08:00
|
|
|
def allowed_user_ids
|
|
|
|
direct_message.user_ids
|
2022-11-02 21:41:30 +08:00
|
|
|
end
|
|
|
|
|
2022-11-02 22:53:36 +08:00
|
|
|
def read_restricted?
|
|
|
|
true
|
|
|
|
end
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2022-11-02 22:53:36 +08:00
|
|
|
def title(user)
|
|
|
|
direct_message.chat_channel_title_for_user(self, user)
|
2022-11-02 21:41:30 +08:00
|
|
|
end
|
2022-11-09 08:28:31 +08:00
|
|
|
|
|
|
|
def ensure_slug_ok
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def generate_auto_slug
|
|
|
|
self.slug = nil
|
|
|
|
end
|
2022-11-02 21:41:30 +08:00
|
|
|
end
|