mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 15:07:35 +01:00
Fix clear notifications creating null user_ids
This commit is contained in:
parent
d7ecf8041a
commit
9d1f098d8a
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
from flask import Blueprint, render_template, redirect, url_for
|
from flask import Blueprint, render_template, redirect, url_for
|
||||||
from flask_user import current_user, login_required
|
from flask_user import current_user, login_required
|
||||||
from app.models import db
|
from app.models import db, Notification
|
||||||
|
|
||||||
bp = Blueprint("notifications", __name__)
|
bp = Blueprint("notifications", __name__)
|
||||||
|
|
||||||
@ -29,6 +29,6 @@ def list_all():
|
|||||||
@bp.route("/notifications/clear/", methods=["POST"])
|
@bp.route("/notifications/clear/", methods=["POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def clear():
|
def clear():
|
||||||
current_user.notifications.clear()
|
Notification.query.filter_by(user=current_user).delete()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return redirect(url_for("notifications.list_all"))
|
return redirect(url_for("notifications.list_all"))
|
||||||
|
Loading…
Reference in New Issue
Block a user