From 8ad066409ce81770e3e6bbfc6232b8b1af20b9a6 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 11 Feb 2022 17:17:11 +0000 Subject: [PATCH] Fix notification digest issue --- app/blueprints/admin/actions.py | 6 ++++++ app/templates/emails/notification_digest.html | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/blueprints/admin/actions.py b/app/blueprints/admin/actions.py index 8f4e1e7c..02694dd4 100644 --- a/app/blueprints/admin/actions.py +++ b/app/blueprints/admin/actions.py @@ -27,6 +27,7 @@ from sqlalchemy import or_, and_ from app.logic.game_support import GameSupportResolver from app.models import PackageRelease, db, Package, PackageState, PackageScreenshot, MetaPackage, User, \ NotificationType, PackageUpdateConfig, License, UserRank, PackageType, PackageGameSupport +from app.tasks.emails import send_pending_digests from app.tasks.forumtasks import importTopicList, checkAllForumAccounts from app.tasks.importtasks import importRepoScreenshot, checkZipRelease, check_for_updates from app.utils import addNotification, get_system_user @@ -330,3 +331,8 @@ def detect_game_support(): resolver = GameSupportResolver() resolver.update_all() db.session.commit() + + +@action("Send pending notif digests") +def do_send_pending_digests(): + send_pending_digests.delay() diff --git a/app/templates/emails/notification_digest.html b/app/templates/emails/notification_digest.html index 3fdf2686..c7992f50 100644 --- a/app/templates/emails/notification_digest.html +++ b/app/templates/emails/notification_digest.html @@ -17,20 +17,23 @@ {% endfor %} -{% for group in notifications | selectattr("package", "none") %} +{% set other_notifications = notifications | selectattr("package", "none") %} + +{% if other_notifications %}

{{ _("Other Notifications") }}

-{% endfor %} +{% endif %} +

{{ _("View Notifications") }}