Merge pull request #834 from simple-login/feature/improve-notif

Improve notification
This commit is contained in:
Son Nguyen Kim 2022-03-10 08:34:29 +01:00 committed by GitHub
commit 9807d32159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 6 deletions

View File

@ -23,6 +23,10 @@ def notification_route(notification_id):
)
return redirect(url_for("dashboard.index"))
if not notification.read:
notification.read = True
Session.commit()
if request.method == "POST":
notification_title = notification.title or notification.message[:20]
Notification.delete(notification_id)

View File

@ -1401,6 +1401,15 @@ def handle_bounce_forward_phase(msg: Message, email_log: EmailLog):
f"Disable alias {alias} because {reason}. {alias.mailboxes} {alias.user}. Last contact {contact}"
)
alias.enabled = False
Notification.create(
user_id=user.id,
title=f"{alias.email} has been disabled due to multiple bounces",
message=Notification.render(
"notification/alias-disable.html", alias=alias, mailbox=mailbox
),
)
Session.commit()
send_email_with_rate_control(

View File

@ -38,15 +38,13 @@
<div class="dropdown-item d-flex" v-for="notification in notifications">
<div class="flex-grow-1">
<div v-html="notification.title" class="font-weight-bold"
<div v-html="notification.title || notification.message"
:class="!notification.read && 'font-weight-bold'"
style="width: 40em; word-wrap:break-word; white-space: normal; overflow: hidden;"></div>
<div v-html="notification.message"
style="width: 40em; word-wrap:break-word; white-space: normal; overflow: hidden; max-height: 100px; text-overflow: ellipsis;">
</div>
<div>
<div v-if="notification.title">
<a :href="'/dashboard/notification/' + notification.id">More</a>
</div>

View File

@ -0,0 +1,10 @@
<div>
There are several emails sent to your alias <b>{{ alias.email }}</b> that have been bounced by your
mailbox <b>{{ mailbox.email }}</b>.
</div>
<div>
As security measure, we have disabled the alias <b>{{ alias.email }}</b>.
</div>