events: Disallow invite->knock membership change

This commit is contained in:
Kévin Commaille 2024-02-27 21:12:43 +01:00 committed by Kévin Commaille
parent 812625fab4
commit 6c7fbb5e88
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,10 @@
# [unreleased]
Bug fixes:
- The `MembershipState::Invite` to `MembershipState::Knock` membership change
now returns `MembershipChange::Error`, due to a spec clarification
Breaking changes:
- The properties of `SecretStorageV1AesHmacSha2Properties` are now `Option`al.

View File

@ -126,6 +126,7 @@ pub(super) fn membership_change<'a>(
| (St::Ban, St::Invite)
| (St::Ban, St::Join)
| (St::Join, St::Knock)
| (St::Invite, St::Knock)
| (St::Ban, St::Knock)
| (St::Knock, St::Join) => Ch::Error,
(St::Join, St::Join)
@ -143,7 +144,7 @@ pub(super) fn membership_change<'a>(
(St::Join, St::Ban) => Ch::KickedAndBanned,
(St::Leave, St::Invite) => Ch::Invited,
(St::Ban, St::Leave) => Ch::Unbanned,
(St::Leave, St::Knock) | (St::Invite, St::Knock) => Ch::Knocked,
(St::Leave, St::Knock) => Ch::Knocked,
(St::Knock, St::Invite) => Ch::KnockAccepted,
(St::Knock, St::Leave) if sender == state_key => Ch::KnockRetracted,
(St::Knock, St::Leave) => Ch::KnockDenied,