Partition Editor notifications away from normal notifications in the notifications list

This commit is contained in:
rubenwardy
2020-12-05 23:09:29 +00:00
parent b3bd7ac615
commit 4944463f56
2 changed files with 59 additions and 4 deletions

View File

@@ -17,7 +17,9 @@
from flask import Blueprint, render_template, redirect, url_for
from flask_login import current_user, login_required
from app.models import db, Notification
from sqlalchemy import or_
from app.models import db, Notification, NotificationType
bp = Blueprint("notifications", __name__)
@@ -25,7 +27,14 @@ bp = Blueprint("notifications", __name__)
@bp.route("/notifications/")
@login_required
def list_all():
return render_template("notifications/list.html")
notifications = Notification.query.filter(Notification.user == current_user,
Notification.type != NotificationType.EDITOR_ALERT, Notification.type != NotificationType.EDITOR_MISC).all()
editor_notifications = Notification.query.filter(Notification.user == current_user,
or_(Notification.type == NotificationType.EDITOR_ALERT, Notification.type == NotificationType.EDITOR_MISC)).all()
return render_template("notifications/list.html",
notifications=notifications, editor_notifications=editor_notifications)
@bp.route("/notifications/clear/", methods=["POST"])