mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-17 04:58:41 -04:00
matrix-sdk: room::Common:messages() don't return decryption error
If decryption fails we want that the user still has access to the events. This was broken in a previous commit.
This commit is contained in:
@@ -205,16 +205,17 @@ impl Common {
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
if let Some(machine) = self.client.olm_machine().await {
|
||||
for event in http_response.chunk {
|
||||
let decrypted_event =
|
||||
if let AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomEncrypted(
|
||||
SyncMessageLikeEvent::Original(encrypted_event),
|
||||
)) = event.deserialize_as::<AnySyncRoomEvent>()?
|
||||
{
|
||||
machine.decrypt_room_event(&encrypted_event, room_id).await?
|
||||
} else {
|
||||
RoomEvent { event, encryption_info: None }
|
||||
};
|
||||
if let Ok(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomEncrypted(
|
||||
SyncMessageLikeEvent::Original(encrypted_event),
|
||||
))) = event.deserialize_as::<AnySyncRoomEvent>()
|
||||
{
|
||||
if let Ok(event) = machine.decrypt_room_event(&encrypted_event, room_id).await {
|
||||
response.chunk.push(event);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let decrypted_event = RoomEvent { event, encryption_info: None };
|
||||
response.chunk.push(decrypted_event);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user