Skip to content

A platform for community discussion. Free, open, simple.

FIX: Chat NotificationLevels extension breaking in prod (#21484)

Martin Brennan616885895a43
diff --git a/plugins/chat/app/models/chat/user_chat_thread_membership.rb b/plugins/chat/app/models/chat/user_chat_thread_membership.rb
index b906211bb23..0b2793e51c2 100644
--- a/plugins/chat/app/models/chat/user_chat_thread_membership.rb
+++ b/plugins/chat/app/models/chat/user_chat_thread_membership.rb
@@ -8,7 +8,7 @@ module Chat
belongs_to :last_read_message, class_name: "Chat::Message", optional: true
belongs_to :thread, class_name: "Chat::Thread", foreign_key: :thread_id
- enum :notification_level, NotificationLevels.chat_levels
+ enum :notification_level, Chat::NotificationLevels.all
end
end
diff --git a/plugins/chat/lib/chat/notification_levels.rb b/plugins/chat/lib/chat/notification_levels.rb
new file mode 100644
index 00000000000..3ac06d6a0fa
--- /dev/null
+++ b/plugins/chat/lib/chat/notification_levels.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module Chat
+ class NotificationLevels
+ def self.all
+ @all_levels ||= Enum.new(muted: 0, normal: 1, tracking: 2, watching: 3)
+ end
+ end
+end
diff --git a/plugins/chat/lib/chat/notification_levels_extension.rb b/plugins/chat/lib/chat/notification_levels_extension.rb
deleted file mode 100644
index d57a65218e7..00000000000
--- a/plugins/chat/lib/chat/notification_levels_extension.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# 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
diff --git a/plugins/chat/plugin.rb b/plugins/chat/plugin.rb
index 81e1ad040d8..d041adfeb3b 100644
--- a/plugins/chat/plugin.rb
+++ b/plugins/chat/plugin.rb
@@ -63,7 +63,6 @@ after_initialize do
User.prepend Chat::UserExtension
Jobs::UserEmail.prepend Chat::UserEmailExtension
Plugin::Instance.prepend Chat::PluginInstanceExtension
- NotificationLevels.prepend Chat::NotificationLevelsExtension
end
if Oneboxer.respond_to?(:register_local_handler)