New 'presence_max_users_shown' site setting (defaults to 5)
This commit is contained in:
parent
8ab585e25f
commit
238e3f8a71
plugins/discourse-presence
|
@ -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.'
|
||||
|
|
|
@ -2,3 +2,7 @@ plugins:
|
|||
presence_enabled:
|
||||
default: true
|
||||
client: true
|
||||
presence_max_users_showns:
|
||||
default: 5
|
||||
min: 1
|
||||
max: 50
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue