display mailbox that a bounce affects
This commit is contained in:
parent
0d117126db
commit
bc55b98e12
|
@ -129,7 +129,7 @@
|
|||
<img src="{{ url_for('static', filename='arrows/forward-arrow.svg') }}" class="arrow">
|
||||
<span class="ml-2">{{ log.alias }}</span>
|
||||
<img src="{{ url_for('static', filename='arrows/blocked-arrow.svg') }}" class="arrow">
|
||||
<span class="ml-2">{{ log.mailbox }}</span>
|
||||
<span class="ml-2">{{ log.email_log.bounced_mailbox() }}</span>
|
||||
</div>
|
||||
{% else %}
|
||||
<div>
|
||||
|
|
|
@ -16,7 +16,7 @@ class AliasLog:
|
|||
is_reply: bool
|
||||
blocked: bool
|
||||
bounced: bool
|
||||
mailbox: str
|
||||
email_log: EmailLog
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
for k, v in kwargs.items():
|
||||
|
@ -63,7 +63,6 @@ def alias_log(alias_id, page_id):
|
|||
|
||||
def get_alias_log(alias: Alias, page_id=0) -> [AliasLog]:
|
||||
logs: [AliasLog] = []
|
||||
mailbox = alias.mailbox_email()
|
||||
|
||||
q = (
|
||||
db.session.query(Contact, EmailLog)
|
||||
|
@ -83,7 +82,7 @@ def get_alias_log(alias: Alias, page_id=0) -> [AliasLog]:
|
|||
is_reply=email_log.is_reply,
|
||||
blocked=email_log.blocked,
|
||||
bounced=email_log.bounced,
|
||||
mailbox=mailbox,
|
||||
email_log=email_log,
|
||||
)
|
||||
logs.append(al)
|
||||
logs = sorted(logs, key=lambda l: l.when, reverse=True)
|
||||
|
|
|
@ -934,6 +934,12 @@ class EmailLog(db.Model, ModelMixin):
|
|||
|
||||
contact = db.relationship(Contact)
|
||||
|
||||
def bounced_mailbox(self) -> str:
|
||||
if self.bounced_mailbox_id:
|
||||
return Mailbox.get(self.bounced_mailbox_id).email
|
||||
# retro-compatibility
|
||||
return self.contact.alias.mailboxes[0].email
|
||||
|
||||
def get_action(self) -> str:
|
||||
"""return the action name: forward|reply|block|bounced"""
|
||||
if self.is_reply:
|
||||
|
|
Loading…
Reference in a new issue