mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2025-01-25 00:25:12 +00:00
users: activation button improvements (#506)
Now uses flask.flash to give the person who clicks it feedback when it's clicked, because caching may make things confusing. Also only activate a user if they're inactive, as again, caching can lead to staff pressing the button multiple times in a row, leading to unnecessary log messages.
This commit is contained in:
parent
8644472533
commit
e892f358e8
|
@ -58,11 +58,12 @@ def view_user(user_name):
|
|||
db.session.add(adminlog)
|
||||
|
||||
if admin_form.activate_user.data and not user.is_banned:
|
||||
user.status = models.UserStatusType.ACTIVE
|
||||
adminlog = models.AdminLog("[{}]({}) was manually activated"
|
||||
.format(user_name, url),
|
||||
admin_id=flask.g.user.id)
|
||||
db.session.add(adminlog)
|
||||
if user.status != models.UserStatusType.ACTIVE:
|
||||
user.status = models.UserStatusType.ACTIVE
|
||||
adminlog = models.AdminLog("[{}]({}) was manually activated"
|
||||
.format(user_name, url), admin_id=flask.g.user.id)
|
||||
db.session.add(adminlog)
|
||||
flask.flash('{} was manually activated'.format(user_name), 'success')
|
||||
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
|
|
Loading…
Reference in a new issue