Return pinned in GET /api/aliases/:alias_id, GET /api/v2/aliases

This commit is contained in:
Son NK 2020-11-15 19:01:11 +01:00
parent f500a495b7
commit f6568aca6a
3 changed files with 9 additions and 3 deletions

View File

@ -65,6 +65,7 @@ def serialize_alias_info_v2(alias_info: AliasInfo) -> dict:
"support_pgp": alias_info.alias.mailbox_support_pgp(),
"disable_pgp": alias_info.alias.disable_pgp,
"latest_activity": None,
"pinned": alias_info.alias.pinned,
}
if alias_info.latest_email_log:
email_log = alias_info.latest_email_log

View File

@ -281,7 +281,7 @@ If success, 200 with the list of aliases. Each alias has the following fields:
- support_pgp: whether an alias can support PGP, i.e. when one of alias's mailboxes supports PGP.
- disable_pgp: whether the PGP is disabled on this alias.
This field should only be used when `support_pgp` is true.
By setting `disable_pgp=true`, a user can explicitly disable PGP on an alias even its mailboxes support PGP.
By setting `disable_pgp=true`, a user can explicitly disable PGP on an alias even its mailboxes support PGP.
- mailbox: obsolete, should use `mailboxes` instead.
- id
- email
@ -295,6 +295,7 @@ If success, 200 with the list of aliases. Each alias has the following fields:
- email
- name
- reverse_alias
- pinned: whether an alias is pinned
Here's an example:
@ -334,7 +335,8 @@ Here's an example:
"nb_block": 0,
"nb_forward": 1,
"nb_reply": 0,
"note": null
"note": null,
"pinned": true
}
]
}
@ -385,7 +387,8 @@ Alias info, use the same format as in /api/v2/aliases. For example:
"nb_block": 0,
"nb_forward": 1,
"nb_reply": 0,
"note": null
"note": null,
"pinned": true
}
```

View File

@ -183,6 +183,7 @@ def test_get_aliases_v2(flask_client):
assert r0["latest_activity"]["contact"]["email"] == "c1@example.com"
assert "name" in r0["latest_activity"]["contact"]
assert "reverse_alias" in r0["latest_activity"]["contact"]
assert "pinned" in r0
def test_delete_alias(flask_client):
@ -607,3 +608,4 @@ def test_get_alias(flask_client):
assert "nb_reply" in res
assert "enabled" in res
assert "note" in res
assert "pinned" in res