mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: allow plugins to send extra silenced message params
allows plugins to send extra custom message params so that they can include things such as silence reason and message_body if desired
This commit is contained in:
parent
9354ee35d2
commit
c3aeb442d7
@ -22,6 +22,11 @@ class UserSilencer
|
|||||||
UserHistory.where(action: UserHistory.actions[:silence_user], post: post).exists?
|
UserHistory.where(action: UserHistory.actions[:silence_user], post: post).exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Allow plugins to update and send extra silence message params
|
||||||
|
def silence_message_params
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
def silence
|
def silence
|
||||||
hide_posts unless @opts[:keep_posts]
|
hide_posts unless @opts[:keep_posts]
|
||||||
unless @user.silenced_till.present?
|
unless @user.silenced_till.present?
|
||||||
@ -36,7 +41,7 @@ class UserSilencer
|
|||||||
).format
|
).format
|
||||||
|
|
||||||
context = "#{message_type}: '#{post.topic&.title rescue ''}' #{@opts[:reason]}"
|
context = "#{message_type}: '#{post.topic&.title rescue ''}' #{@opts[:reason]}"
|
||||||
SystemMessage.create(@user, message_type)
|
SystemMessage.create(@user, message_type, **silence_message_params)
|
||||||
|
|
||||||
if @by_user
|
if @by_user
|
||||||
log_params = { context: context, details: details }
|
log_params = { context: context, details: details }
|
||||||
|
Loading…
Reference in New Issue
Block a user