Merge pull request #251 from simple-login/pgp-api

Pgp api
This commit is contained in:
Son Nguyen Kim 2020-08-04 20:22:35 +02:00 committed by GitHub
commit 0a50b21450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -964,6 +964,8 @@ If success, 200 with the list of aliases. Each alias has the following fields:
- nb_block
- nb_forward
- nb_reply
- support_pgp: whether an alias can support PGP, i.e. when one of alias's mailboxes supports PGP.
- pgp_enabled: whether the PGP is enabled on this alias. This field should only be used when `support_pgp` is true.
- mailbox: obsolete, should use `mailboxes` instead.
- id
- email

View File

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

View File

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

View File

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