A platform for community discussion. Free, open, simple.
New 'presence_max_users_shown' site setting (defaults to 5)
Régis Hanol238e3f8a71a1
diff --git a/plugins/discourse-presence/config/locales/server.en.yml b/plugins/discourse-presence/config/locales/server.en.ymlindex 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.ymlindex 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: trueclient: true+ presence_max_users_showns:+ default: 5+ min: 1+ max: 50diff --git a/plugins/discourse-presence/plugin.rb b/plugins/discourse-presence/plugin.rbindex f1e43f3f7e0..fd6dc6a0540 100644--- a/plugins/discourse-presence/plugin.rb+++ b/plugins/discourse-presence/plugin.rb@@ -8,7 +8,7 @@ enabled_site_setting :presence_enabledregister_asset 'stylesheets/presence.scss'-PLUGIN_NAME ||= "discourse-presence".freeze+PLUGIN_NAME ||= -"discourse-presence"after_initialize do@@ -103,8 +103,7 @@ after_initialize dorequires_plugin PLUGIN_NAMEbefore_action :ensure_logged_in- ACTIONS ||= %w{edit reply}.each(&:freeze)- MAX_USERS ||= 20+ ACTIONS ||= [-"edit", -"reply"].freezedef publishdata = 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