Return support_pgp in GET /api/v2/aliases

This commit is contained in:
Son NK 2020-08-04 20:09:42 +02:00
parent 3d2a325e55
commit 03841693ba
4 changed files with 6 additions and 0 deletions

View file

@ -964,6 +964,7 @@ If success, 200 with the list of aliases. Each alias has the following fields:
- nb_block - nb_block
- nb_forward - nb_forward
- nb_reply - nb_reply
- support_pgp: whether an alias can support PGP, i.e. when one of alias's mailboxes supports PGP.
- mailbox: obsolete, should use `mailboxes` instead. - mailbox: obsolete, should use `mailboxes` instead.
- id - id
- email - email

View file

@ -62,6 +62,7 @@ def serialize_alias_info_v2(alias_info: AliasInfo) -> dict:
{"id": mailbox.id, "email": mailbox.email} {"id": mailbox.id, "email": mailbox.email}
for mailbox in alias_info.mailboxes for mailbox in alias_info.mailboxes
], ],
"support_pgp": alias_info.alias.mailbox_support_pgp()
} }
if alias_info.latest_email_log: if alias_info.latest_email_log:
email_log = alias_info.latest_email_log email_log = alias_info.latest_email_log

View file

@ -84,6 +84,7 @@ def get_aliases_v2():
- note - note
- mailbox - mailbox
- mailboxes - mailboxes
- support_pgp
- (optional) latest_activity: - (optional) latest_activity:
- timestamp - timestamp
- action: forward|reply|block|bounced - action: forward|reply|block|bounced

View file

@ -187,6 +187,9 @@ def test_get_aliases_v2(flask_client):
assert "id" in mailbox assert "id" in mailbox
assert "email" in mailbox assert "email" in mailbox
assert "support_pgp" in r0
assert not r0["support_pgp"]
def test_delete_alias(flask_client): def test_delete_alias(flask_client):
user = User.create( user = User.create(