Masked email acceptance tests 1 to 11, with ME-9, ME-10, ME-11 and /changes (ME-1 to ME-19)
tests/src/system/masked_email.rs runs from system_tests and alone as masked_email_tests. Fastmail's MaskedEmail/set updates from the stored object, so the registry's revision check holds.
This commit is contained in:
@@ -274,13 +274,18 @@ pub async fn set(
|
||||
}
|
||||
changed.enabled = new_state.is_live();
|
||||
if changed != mask.object {
|
||||
let old = Object::from(mask.object.clone());
|
||||
// The stored object carries the revision the write is checked against
|
||||
let Some(old) = registry
|
||||
.get(ObjectId::new(ObjectType::MaskedEmail, id))
|
||||
.await?
|
||||
else {
|
||||
response.not_updated.append(id, SetError::not_found());
|
||||
continue;
|
||||
};
|
||||
let mut new = old.clone();
|
||||
new.inner = Object::from(changed.clone()).inner;
|
||||
match registry
|
||||
.write(RegistryWrite::update(
|
||||
id,
|
||||
&Object::from(changed.clone()),
|
||||
&old,
|
||||
))
|
||||
.write(RegistryWrite::update(id, &new, &old))
|
||||
.await?
|
||||
{
|
||||
RegistryWriteResult::Success(_) => {}
|
||||
|
||||
@@ -186,7 +186,7 @@ impl CreateRefusal {
|
||||
/// `x:MaskedEmail/set`: a mask about to be created or changed (ME-12 to
|
||||
/// ME-17). On an update, the server-set and create-only fields keep their
|
||||
/// stored values.
|
||||
pub async fn validate(
|
||||
pub(crate) async fn validate(
|
||||
set: &RegistrySetResponse<'_>,
|
||||
mask: &mut MaskedEmail,
|
||||
old: Option<&MaskedEmail>,
|
||||
@@ -285,7 +285,7 @@ pub async fn read(server: &Server, id: Id, mask: &mut MaskedEmail) -> trc::Resul
|
||||
|
||||
/// `x:MaskedEmail/query`, which also filters on `enabled`, `forDomain` and
|
||||
/// text in the address and description (a fork addition).
|
||||
pub async fn query(mut req: RegistryQueryResponse<'_>) -> trc::Result<QueryResponseBuilder> {
|
||||
pub(crate) async fn query(mut req: RegistryQueryResponse<'_>) -> trc::Result<QueryResponseBuilder> {
|
||||
let account_id = req.request.account_id.document_id();
|
||||
assert_can_manage(req.server, req.access_token, account_id).await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user