diff --git a/app/models/user.py b/app/models/user.py index 13ae483..fc4a723 100644 --- a/app/models/user.py +++ b/app/models/user.py @@ -397,8 +397,7 @@ class Member(User): Notify a user with a message. An hyperlink can be added to redirect to the notification source """ - # return - n = Notification(self.id, message, href=href) + n = Notification(self, message, href=href) db.session.add(n) db.session.commit() diff --git a/app/routes/admin/login_as.py b/app/routes/admin/login_as.py index 500eabf..fd0ecbc 100644 --- a/app/routes/admin/login_as.py +++ b/app/routes/admin/login_as.py @@ -78,8 +78,14 @@ def adm_logout_as(): flash("Vous avez vraiment agi de manière stupide.", "error") abort(403) - victim_name = current_user.name user = Member.query.get(id) + + # Send a notification to vandalized user + current_user.notify(f"{user.name} a accédé à ce compte à des fins de modération", + url_for('user', username=user.name)) + + # Switch back to admin + victim_name = current_user.name logout_user() login_user(user)