replace unnecessary check when updating device keys
Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
parent
658c19d55e
commit
7bf92c8a37
2 changed files with 17 additions and 5 deletions
|
@ -290,7 +290,7 @@ pub(crate) async fn add_backup_keys_for_session_route(
|
||||||
new_forwarded_count < old_forwarded_count
|
new_forwarded_count < old_forwarded_count
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok_to_replace {
|
if ok_to_replace {
|
||||||
|
|
|
@ -80,14 +80,26 @@ pub(crate) async fn upload_keys_route(
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: merge this and the existing event?
|
if let Ok(existing_keys) = services
|
||||||
// This check is needed to assure that signatures are kept
|
|
||||||
if services
|
|
||||||
.users
|
.users
|
||||||
.get_device_keys(sender_user, sender_device)
|
.get_device_keys(sender_user, sender_device)
|
||||||
.await
|
.await
|
||||||
.is_err()
|
|
||||||
{
|
{
|
||||||
|
if existing_keys.json().get() == device_keys.json().get() {
|
||||||
|
debug!(
|
||||||
|
?sender_user,
|
||||||
|
?sender_device,
|
||||||
|
?device_keys,
|
||||||
|
"Ignoring user uploaded keys as they are an exact copy already in the \
|
||||||
|
database"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
services
|
||||||
|
.users
|
||||||
|
.add_device_keys(sender_user, sender_device, device_keys)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
services
|
services
|
||||||
.users
|
.users
|
||||||
.add_device_keys(sender_user, sender_device, device_keys)
|
.add_device_keys(sender_user, sender_device, device_keys)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue