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.
@@ -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(
+ if let Ok(AnySyncRoomEvent::MessageLike(AnySyncMessageLikeEvent::RoomEncrypted(
SyncMessageLikeEvent::Original(encrypted_event),
- )) = event.deserialize_as::<AnySyncRoomEvent>()?
+ ))) = event.deserialize_as::<AnySyncRoomEvent>()
{
- machine.decrypt_room_event(&encrypted_event, room_id).await?
- } else {
- RoomEvent { event, encryption_info: None }
- };
+ 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 {
