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">
|
<img src="{{ url_for('static', filename='arrows/forward-arrow.svg') }}" class="arrow">
|
||||||
<span class="ml-2">{{ log.alias }}</span>
|
<span class="ml-2">{{ log.alias }}</span>
|
||||||
<img src="{{ url_for('static', filename='arrows/blocked-arrow.svg') }}" class="arrow">
|
<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>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AliasLog:
|
||||||
is_reply: bool
|
is_reply: bool
|
||||||
blocked: bool
|
blocked: bool
|
||||||
bounced: bool
|
bounced: bool
|
||||||
mailbox: str
|
email_log: EmailLog
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
for k, v in kwargs.items():
|
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]:
|
def get_alias_log(alias: Alias, page_id=0) -> [AliasLog]:
|
||||||
logs: [AliasLog] = []
|
logs: [AliasLog] = []
|
||||||
mailbox = alias.mailbox_email()
|
|
||||||
|
|
||||||
q = (
|
q = (
|
||||||
db.session.query(Contact, EmailLog)
|
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,
|
is_reply=email_log.is_reply,
|
||||||
blocked=email_log.blocked,
|
blocked=email_log.blocked,
|
||||||
bounced=email_log.bounced,
|
bounced=email_log.bounced,
|
||||||
mailbox=mailbox,
|
email_log=email_log,
|
||||||
)
|
)
|
||||||
logs.append(al)
|
logs.append(al)
|
||||||
logs = sorted(logs, key=lambda l: l.when, reverse=True)
|
logs = sorted(logs, key=lambda l: l.when, reverse=True)
|
||||||
|
|
|
@ -934,6 +934,12 @@ class EmailLog(db.Model, ModelMixin):
|
||||||
|
|
||||||
contact = db.relationship(Contact)
|
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:
|
def get_action(self) -> str:
|
||||||
"""return the action name: forward|reply|block|bounced"""
|
"""return the action name: forward|reply|block|bounced"""
|
||||||
if self.is_reply:
|
if self.is_reply:
|
||||||
|
|
Loading…
Reference in a new issue