Fix notification digest issue

This commit is contained in:
rubenwardy 2022-02-11 17:17:11 +00:00
parent 4ac8949c3a
commit 8ad066409c
2 changed files with 12 additions and 3 deletions

@ -27,6 +27,7 @@ from sqlalchemy import or_, and_
from app.logic.game_support import GameSupportResolver from app.logic.game_support import GameSupportResolver
from app.models import PackageRelease, db, Package, PackageState, PackageScreenshot, MetaPackage, User, \ from app.models import PackageRelease, db, Package, PackageState, PackageScreenshot, MetaPackage, User, \
NotificationType, PackageUpdateConfig, License, UserRank, PackageType, PackageGameSupport NotificationType, PackageUpdateConfig, License, UserRank, PackageType, PackageGameSupport
from app.tasks.emails import send_pending_digests
from app.tasks.forumtasks import importTopicList, checkAllForumAccounts from app.tasks.forumtasks import importTopicList, checkAllForumAccounts
from app.tasks.importtasks import importRepoScreenshot, checkZipRelease, check_for_updates from app.tasks.importtasks import importRepoScreenshot, checkZipRelease, check_for_updates
from app.utils import addNotification, get_system_user from app.utils import addNotification, get_system_user
@ -330,3 +331,8 @@ def detect_game_support():
resolver = GameSupportResolver() resolver = GameSupportResolver()
resolver.update_all() resolver.update_all()
db.session.commit() db.session.commit()
@action("Send pending notif digests")
def do_send_pending_digests():
send_pending_digests.delay()

@ -17,20 +17,23 @@
</ul> </ul>
{% endfor %} {% endfor %}
{% for group in notifications | selectattr("package", "none") %} {% set other_notifications = notifications | selectattr("package", "none") %}
{% if other_notifications %}
<h2> <h2>
{{ _("Other Notifications") }} {{ _("Other Notifications") }}
</h2> </h2>
<ul> <ul>
{% for notification in group %} {% for notification in other_notifications %}
<li> <li>
<a href="{{ notification.url | abs_url }}">{{ notification.title }}</a> - <a href="{{ notification.url | abs_url }}">{{ notification.title }}</a> -
{{ _("from %(username)s.", username=notification.causer.username) }} {{ _("from %(username)s.", username=notification.causer.username) }}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endfor %} {% endif %}
<p style="margin-top: 3em;"> <p style="margin-top: 3em;">
<a class="btn" href="{{ abs_url_for('notifications.list_all') }}"> <a class="btn" href="{{ abs_url_for('notifications.list_all') }}">
{{ _("View Notifications") }} {{ _("View Notifications") }}