notifications: fixed notifications

This commit is contained in:
Darks 2023-06-20 19:38:04 +02:00 committed by Eragon
parent 8d90f640b6
commit d05942b660
Signed by: Eragon
GPG Key ID: 087126EBFC725006
2 changed files with 8 additions and 3 deletions

View File

@ -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()

View File

@ -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)