When banning a user, a reason can be provided. The user will see this reason when trying to log in. Also log bans and unbans in the staff action logs.

This commit is contained in:
Neil Lalonde
2013-11-01 10:47:03 -04:00
parent 52b0c1c45f
commit 92a0729937
17 changed files with 180 additions and 26 deletions

View File

@@ -57,6 +57,23 @@ class StaffActionLogger
}))
end
def log_user_ban(user, reason, opts={})
raise Discourse::InvalidParameters.new('user is nil') unless user
UserHistory.create( params(opts).merge({
action: UserHistory.actions[:ban_user],
target_user_id: user.id,
details: reason
}))
end
def log_user_unban(user, opts={})
raise Discourse::InvalidParameters.new('user is nil') unless user
UserHistory.create( params(opts).merge({
action: UserHistory.actions[:unban_user],
target_user_id: user.id
}))
end
private
def params(opts)