Add discourse events for when a user is suspended/silenced

This commit is contained in:
Robin Ward 2018-01-11 12:56:28 -05:00
parent a0f0ed576a
commit dd33050e10
2 changed files with 22 additions and 0 deletions

View File

@ -82,6 +82,17 @@ class Admin::UsersController < Admin::AdminController
)
end
DiscourseEvent.trigger(
:user_suspended,
user: @user,
reason: params[:reason],
message: message,
user_history: user_history,
post_id: params[:post_id],
suspended_till: params[:suspend_until],
suspended_at: DateTime.now
)
render_json_dump(
suspension: {
suspended: true,

View File

@ -34,6 +34,17 @@ class UserSilencer
details: details
)
end
DiscourseEvent.trigger(
:user_silenced,
user: @user,
reason: @opts[:reason],
message: @opts[:message_body],
user_history: @user_history,
post_id: @opts[:post_id],
silenced_till: @user.silenced_till,
silenced_at: DateTime.now
)
return true
end
else