Add email notification prompt to post-login hook

This commit is contained in:
rubenwardy 2021-07-31 21:35:07 +01:00
parent aae546a08e
commit 6bbe2307e9
3 changed files with 21 additions and 8 deletions

View File

@ -237,15 +237,15 @@ def remind_outdated():
@action("Import licenses from SPDX")
def import_licenses():
renames = {
"GPLv2" : "GPL-2.0-only",
"GPLv3" : "GPL-3.0-only",
"AGPLv2" : "AGPL-2.0-only",
"AGPLv3" : "AGPL-3.0-only",
"LGPLv2.1" : "LGPL-2.1-only",
"LGPLv3" : "LGPL-3.0-only",
"Apache 2.0" : "Apache-2.0",
"GPLv2": "GPL-2.0-only",
"GPLv3": "GPL-3.0-only",
"AGPLv2": "AGPL-2.0-only",
"AGPLv3": "AGPL-3.0-only",
"LGPLv2.1": "LGPL-2.1-only",
"LGPLv3": "LGPL-3.0-only",
"Apache 2.0": "Apache-2.0",
"BSD 2-Clause / FreeBSD": "BSD-2-Clause-FreeBSD",
"BSD 3-Clause" : "BSD-3-Clause",
"BSD 3-Clause": "BSD-3-Clause",
"CC0": "CC0-1.0",
"CC BY 3.0": "CC-BY-3.0",
"CC BY 4.0": "CC-BY-4.0",

View File

@ -5,6 +5,15 @@
{% endblock %}
{% block content %}
{% if user.notification_preferences is none %}
<h2>{{ _("Misc To do") }}</h2>
<div class="list-group mt-3 mb-5">
<a class="list-group-item list-group-item-action"
href="{{ url_for('users.email_notifications', username=user.username) }}">
{{ _("Enable email notifications") }}
</a>
</div>
{% endif %}
<h2>{{ _("Unapproved Packages Needing Action") }}</h2>
<div class="list-group mt-3 mb-5">
{% for package in unapproved_packages %}

View File

@ -49,6 +49,10 @@ def post_login(user: User, next_url):
flash("You have a lot of notifications, you should either read or clear them", "info")
return redirect(url_for("notifications.list_all"))
if user.notification_preferences is None:
flash("Please consider enabling email notifications, you can customise how much is sent", "info")
return redirect(url_for("users.email_notifications", username=user.username))
return redirect(url_for("homepage.home"))