Add an event if a user is archived

This adds a new type of event, 'archive_user', which stores the id of
the archived user and the id of the user who is doing the archiving.
This commit is contained in:
Katie Smith
2019-05-22 14:05:19 +01:00
parent 73b4aa4d85
commit f57f8641ad
4 changed files with 50 additions and 1 deletions

View File

@@ -1,7 +1,8 @@
from flask import flash, redirect, render_template, request, url_for
from flask_login import login_required
from flask_login import current_user, login_required
from app import user_api_client
from app.event_handlers import create_archive_user_event
from app.main import main
from app.main.forms import SearchUsersByEmailForm
from app.models.user import User
@@ -45,6 +46,8 @@ def user_information(user_id):
def archive_user(user_id):
if request.method == 'POST':
user_api_client.archive_user(user_id)
create_archive_user_event(str(user_id), current_user.id)
return redirect(url_for('.user_information', user_id=user_id))
else:
flash('There\'s no way to reverse this! Are you sure you want to archive this user?', 'delete')