fix(crypto): Only send cancellations if there were multiple request recipients

master
Damir Jelić 2021-09-15 20:28:16 +02:00
parent ff9bb94ab4
commit 7764f01b59
1 changed files with 14 additions and 6 deletions

View File

@ -532,12 +532,20 @@ impl VerificationRequest {
.filter(|d| if let Some(device) = filter_device { &**d != device } else { true }) .filter(|d| if let Some(device) = filter_device { &**d != device } else { true })
.collect(); .collect();
Some(ToDeviceRequest::new_for_recipients( // We don't need to notify anyone if no recipients were present
self.other_user(), // but we did have a filter device, since this means that only a
recipients, // single device received the `m.key.verification.request` and that
c, // device accepted the request.
Uuid::new_v4(), if recipients.is_empty() && filter_device.is_some() {
)) None
} else {
Some(ToDeviceRequest::new_for_recipients(
self.other_user(),
recipients,
c,
Uuid::new_v4(),
))
}
} else { } else {
None None
} }