diff --git a/plugins/discourse-presence/config/locales/server.en.yml b/plugins/discourse-presence/config/locales/server.en.yml index 72768d3f25f..1de132d6967 100644 --- a/plugins/discourse-presence/config/locales/server.en.yml +++ b/plugins/discourse-presence/config/locales/server.en.yml @@ -1,3 +1,4 @@ en: site_settings: presence_enabled: 'Show users that are currently replying to the current topic, or editing the current post?' + presence_max_users_shown: 'Maximum number of users shown.' diff --git a/plugins/discourse-presence/config/settings.yml b/plugins/discourse-presence/config/settings.yml index 56341eeea26..50c44b0b691 100644 --- a/plugins/discourse-presence/config/settings.yml +++ b/plugins/discourse-presence/config/settings.yml @@ -2,3 +2,7 @@ plugins: presence_enabled: default: true client: true + presence_max_users_showns: + default: 5 + min: 1 + max: 50 diff --git a/plugins/discourse-presence/plugin.rb b/plugins/discourse-presence/plugin.rb index f1e43f3f7e0..fd6dc6a0540 100644 --- a/plugins/discourse-presence/plugin.rb +++ b/plugins/discourse-presence/plugin.rb @@ -8,7 +8,7 @@ enabled_site_setting :presence_enabled register_asset 'stylesheets/presence.scss' -PLUGIN_NAME ||= "discourse-presence".freeze +PLUGIN_NAME ||= -"discourse-presence" after_initialize do @@ -103,8 +103,7 @@ after_initialize do requires_plugin PLUGIN_NAME before_action :ensure_logged_in - ACTIONS ||= %w{edit reply}.each(&:freeze) - MAX_USERS ||= 20 + ACTIONS ||= [-"edit", -"reply"].freeze def publish data = params.permit( @@ -158,7 +157,7 @@ after_initialize do { messagebus_channel: channel, messagebus_id: MessageBus.last_id(channel), - users: users.limit(MAX_USERS).map { |u| BasicUserSerializer.new(u, root: false) } + users: users.limit(SiteSetting.presence_max_users_shown).map { |u| BasicUserSerializer.new(u, root: false) } } end