mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 23:34:05 +08:00
take into account alias.cannot_be_disabled in should_disable
This commit is contained in:
parent
79f22857b5
commit
c431abd917
2 changed files with 5 additions and 4 deletions
|
@ -922,6 +922,11 @@ def normalize_reply_email(reply_email: str) -> str:
|
|||
|
||||
def should_disable(alias: Alias) -> bool:
|
||||
"""Disable an alias if it has more than 5 bounces in the last 24h"""
|
||||
# Bypass the bounce rule
|
||||
if alias.cannot_be_disabled:
|
||||
LOG.warning("%s cannot be disabled", alias)
|
||||
return False
|
||||
|
||||
yesterday = arrow.now().shift(days=-1)
|
||||
nb_bounced_last_24h = (
|
||||
db.session.query(EmailLog)
|
||||
|
|
|
@ -1325,10 +1325,6 @@ def handle_bounce_forward_phase(msg: Message, email_log: EmailLog):
|
|||
|
||||
refused_email_url = f"{URL}/dashboard/refused_email?highlight_id={email_log.id}"
|
||||
|
||||
nb_bounced = EmailLog.filter_by(contact_id=contact.id, bounced=True).count()
|
||||
if nb_bounced >= 2 and alias.cannot_be_disabled:
|
||||
LOG.warning("%s cannot be disabled", alias)
|
||||
|
||||
# inform user of this bounce
|
||||
if not should_disable(alias):
|
||||
LOG.d(
|
||||
|
|
Loading…
Reference in a new issue