From 4944463f5617c2382bfffce3bb2b1d9c44768673 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Sat, 5 Dec 2020 23:09:29 +0000
Subject: [PATCH] Partition Editor notifications away from normal notifications
in the notifications list
---
app/blueprints/notifications/__init__.py | 13 +++++-
app/templates/notifications/list.html | 50 +++++++++++++++++++++++-
2 files changed, 59 insertions(+), 4 deletions(-)
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 %}
Notifications
@@ -20,8 +23,12 @@ Notifications
{% endif %}
+ {% if editor_notifications %}
+ Your Notifications
+ {% endif %}
+