mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Create UserChatThreadMembership table and model (#21481)
This will enable us to begin work on user tracking state for a thread so we can show thread-specific unreads and mentions indicators. In this case are following the core notification_level paradigm rather than the solution UserChatChannelMembership went with, and eventually we will want to refactor the other table to match this as well. Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
13
plugins/chat/lib/chat/notification_levels_extension.rb
Normal file
13
plugins/chat/lib/chat/notification_levels_extension.rb
Normal file
@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Chat
|
||||
module NotificationLevelsExtension
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
class_methods do
|
||||
def chat_levels
|
||||
@chat_levels ||= Enum.new(muted: 0, normal: 1, tracking: 2, watching: 3)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -8,6 +8,9 @@ module Chat
|
||||
has_many :user_chat_channel_memberships,
|
||||
class_name: "Chat::UserChatChannelMembership",
|
||||
dependent: :destroy
|
||||
has_many :user_chat_thread_memberships,
|
||||
class_name: "Chat::UserChatThreadMembership",
|
||||
dependent: :destroy
|
||||
has_many :chat_message_reactions, class_name: "Chat::MessageReaction", dependent: :destroy
|
||||
has_many :chat_mentions, class_name: "Chat::Mention"
|
||||
end
|
||||
|
Reference in New Issue
Block a user