mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
More extensibility for custom silence/suspend messages
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
require_dependency 'staff_message_format'
|
||||
|
||||
# Responsible for logging the actions of admins and moderators.
|
||||
class StaffActionLogger
|
||||
|
||||
@@ -170,8 +172,7 @@ class StaffActionLogger
|
||||
def log_user_suspend(user, reason, opts = {})
|
||||
raise Discourse::InvalidParameters.new(:user) unless user
|
||||
|
||||
details = (reason || '').dup
|
||||
details << "\n\n#{opts[:message]}" if opts[:message].present?
|
||||
details = StaffMessageFormat.new(:suspend, reason, opts[:message]).format
|
||||
|
||||
args = params(opts).merge(
|
||||
action: UserHistory.actions[:suspend_user],
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require_dependency 'staff_message_format'
|
||||
|
||||
class UserSilencer
|
||||
|
||||
attr_reader :user_history
|
||||
@@ -21,8 +23,11 @@ class UserSilencer
|
||||
if @user.save
|
||||
message_type = @opts[:message] || :silenced_by_staff
|
||||
|
||||
details = (@opts[:reason] || '').dup
|
||||
details << "\n\n#{@opts[:message_body]}" if @opts[:message_body].present?
|
||||
details = StaffMessageFormat.new(
|
||||
:silence,
|
||||
@opts[:reason],
|
||||
@opts[:message_body]
|
||||
).format
|
||||
|
||||
context = "#{message_type}: '#{post.topic&.title rescue ''}' #{@opts[:reason]}"
|
||||
SystemMessage.create(@user, message_type)
|
||||
|
||||
Reference in New Issue
Block a user