mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 23:34:05 +08:00
Add reverse_alias_address to GET /api/aliases/:alias_id/activities
This commit is contained in:
parent
aada12f17e
commit
145fc9c67c
4 changed files with 6 additions and 8 deletions
|
@ -200,6 +200,7 @@ def get_alias_activities(alias_id):
|
|||
activity = {
|
||||
"timestamp": alias_log.when.timestamp,
|
||||
"reverse_alias": alias_log.reverse_alias,
|
||||
"reverse_alias_address": alias_log.contact.reply_email,
|
||||
}
|
||||
if alias_log.is_reply:
|
||||
activity["from"] = alias_log.alias
|
||||
|
|
|
@ -17,6 +17,7 @@ class AliasLog:
|
|||
blocked: bool
|
||||
bounced: bool
|
||||
email_log: EmailLog
|
||||
contact: Contact
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
for k, v in kwargs.items():
|
||||
|
@ -83,6 +84,7 @@ def get_alias_log(alias: Alias, page_id=0) -> [AliasLog]:
|
|||
blocked=email_log.blocked,
|
||||
bounced=email_log.bounced,
|
||||
email_log=email_log,
|
||||
contact=contact
|
||||
)
|
||||
logs.append(al)
|
||||
logs = sorted(logs, key=lambda l: l.when, reverse=True)
|
||||
|
|
10
docs/api.md
10
docs/api.md
|
@ -449,14 +449,8 @@ If success, 200 with the list of activities, for example:
|
|||
"from": "yes_meo_chat@sl.local",
|
||||
"timestamp": 1580903760,
|
||||
"to": "marketing@example.com",
|
||||
"reverse_alias": "\"marketing at example.com\" <reply@a.b>"
|
||||
},
|
||||
{
|
||||
"action": "reply",
|
||||
"from": "yes_meo_chat@sl.local",
|
||||
"timestamp": 1580903760,
|
||||
"to": "marketing@example.com",
|
||||
"reverse_alias": "\"marketing at example.com\" <reply@a.b>"
|
||||
"reverse_alias": "\"marketing at example.com\" <reply@a.b>",
|
||||
"reverse_alias_address": "reply@a.b"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -272,6 +272,7 @@ def test_alias_activities(flask_client):
|
|||
assert ac["timestamp"]
|
||||
assert ac["action"]
|
||||
assert ac["reverse_alias"]
|
||||
assert ac["reverse_alias_address"]
|
||||
|
||||
# second page, should return 1 or 2 results only
|
||||
r = flask_client.get(
|
||||
|
|
Loading…
Reference in a new issue