mirror of
https://github.com/simple-login/app.git
synced 2025-09-14 10:34:36 +08:00
return reverse_alias_address in POST /api/aliases/:alias_id/contacts and GET /api/aliases/:alias_id/contacts
This commit is contained in:
parent
9154b4656d
commit
aada12f17e
3 changed files with 8 additions and 3 deletions
|
@ -92,6 +92,7 @@ def serialize_contact(contact: Contact) -> dict:
|
||||||
"last_email_sent_timestamp": None,
|
"last_email_sent_timestamp": None,
|
||||||
"contact": contact.website_email,
|
"contact": contact.website_email,
|
||||||
"reverse_alias": contact.website_send_to(),
|
"reverse_alias": contact.website_send_to(),
|
||||||
|
"reverse_alias_address": contact.reply_email,
|
||||||
}
|
}
|
||||||
|
|
||||||
email_log: EmailLog = contact.last_reply()
|
email_log: EmailLog = contact.last_reply()
|
||||||
|
|
|
@ -510,7 +510,8 @@ If success, 200 with the list of contacts, for example:
|
||||||
"creation_timestamp": 1582284900,
|
"creation_timestamp": 1582284900,
|
||||||
"last_email_sent_date": "2020-02-21 11:35:00+00:00",
|
"last_email_sent_date": "2020-02-21 11:35:00+00:00",
|
||||||
"last_email_sent_timestamp": 1582284900,
|
"last_email_sent_timestamp": 1582284900,
|
||||||
"reverse_alias": "newsletter at example.com <reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co>"
|
"reverse_alias": "newsletter at example.com <reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co>",
|
||||||
|
"reverse_alias_address": "reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -531,7 +532,7 @@ Output:
|
||||||
If success, return 201
|
If success, return 201
|
||||||
Return 409 if contact is already added.
|
Return 409 if contact is already added.
|
||||||
|
|
||||||
```
|
```json
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"contact": "First Last <first@example.com>",
|
"contact": "First Last <first@example.com>",
|
||||||
|
@ -539,7 +540,8 @@ Return 409 if contact is already added.
|
||||||
"creation_timestamp": 1584186761,
|
"creation_timestamp": 1584186761,
|
||||||
"last_email_sent_date": null,
|
"last_email_sent_date": null,
|
||||||
"last_email_sent_timestamp": null,
|
"last_email_sent_timestamp": null,
|
||||||
"reverse_alias": "First Last first@example.com <ra+qytyzjhrumrreuszrbjxqjlkh@sl.local>"
|
"reverse_alias": "First Last first@example.com <ra+qytyzjhrumrreuszrbjxqjlkh@sl.local>",
|
||||||
|
"reverse_alias_address": "reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -476,6 +476,7 @@ def test_alias_contacts(flask_client):
|
||||||
assert ac["last_email_sent_timestamp"]
|
assert ac["last_email_sent_timestamp"]
|
||||||
assert ac["contact"]
|
assert ac["contact"]
|
||||||
assert ac["reverse_alias"]
|
assert ac["reverse_alias"]
|
||||||
|
assert ac["reverse_alias_address"]
|
||||||
|
|
||||||
# second page, should return 1 result only
|
# second page, should return 1 result only
|
||||||
r = flask_client.get(
|
r = flask_client.get(
|
||||||
|
@ -511,6 +512,7 @@ def test_create_contact_route(flask_client):
|
||||||
assert r.json["last_email_sent_date"] is None
|
assert r.json["last_email_sent_date"] is None
|
||||||
assert r.json["last_email_sent_timestamp"] is None
|
assert r.json["last_email_sent_timestamp"] is None
|
||||||
assert r.json["reverse_alias"]
|
assert r.json["reverse_alias"]
|
||||||
|
assert r.json["reverse_alias_address"]
|
||||||
|
|
||||||
# re-add a contact, should return 409
|
# re-add a contact, should return 409
|
||||||
r = flask_client.post(
|
r = flask_client.post(
|
||||||
|
|
Loading…
Add table
Reference in a new issue