mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Chat NotificationLevels extension breaking in prod (#21484)
When setting DISCOURSE_ZEITWERK_EAGER_LOAD=1 to enable eager loading the previous solution to adding chat_levels to the core NotificationLevels would break with a module loading error (c.f. cc2570fce38579202d0e295c153310310f6feb14) We don't actually _need_ to extend the core class, we can just make our own for chat, let's do this instead.
This commit is contained in:
9
plugins/chat/lib/chat/notification_levels.rb
Normal file
9
plugins/chat/lib/chat/notification_levels.rb
Normal file
@ -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
|
@ -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
|
Reference in New Issue
Block a user