diff --git a/app/blueprints/notifications/__init__.py b/app/blueprints/notifications/__init__.py index f83d63f1..71de7d8a 100644 --- a/app/blueprints/notifications/__init__.py +++ b/app/blueprints/notifications/__init__.py @@ -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"]) diff --git a/app/templates/notifications/list.html b/app/templates/notifications/list.html index 85178742..d2f54901 100644 --- a/app/templates/notifications/list.html +++ b/app/templates/notifications/list.html @@ -10,6 +10,9 @@ Notifications + + {{ _("Edit email notification settings") }} + {% endif %}
No notifications
{% endfor %} - +No notifications
+ {% endfor %} +