mirror of
https://github.com/simple-login/app.git
synced 2025-02-22 23:02:55 +08:00
Merge pull request #834 from simple-login/feature/improve-notif
Improve notification
This commit is contained in:
commit
9807d32159
4 changed files with 27 additions and 6 deletions
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
10
templates/notification/alias-disable.html
Normal file
10
templates/notification/alias-disable.html
Normal 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>
|
||||
|
Loading…
Reference in a new issue