[fractal/logs-sensitive: 12/12] Don't log random unrecognized events




commit 75ccf80145a2fe87588c9a2744bef92d35eedec0
Author: Alejandro Domínguez <adomu net-c com>
Date:   Fri Dec 4 12:57:36 2020 +0100

    Don't log random unrecognized events

 fractal-gtk/src/appop/sync.rs | 46 +++++++++++++++++--------------------------
 1 file changed, 18 insertions(+), 28 deletions(-)
---
diff --git a/fractal-gtk/src/appop/sync.rs b/fractal-gtk/src/appop/sync.rs
index 26cb7b7a..865a5f95 100644
--- a/fractal-gtk/src/appop/sync.rs
+++ b/fractal-gtk/src/appop/sync.rs
@@ -9,7 +9,7 @@ use crate::model::{
     room::{Room, RoomMembership, RoomTag},
 };
 use crate::util::i18n::i18n;
-use log::{error, warn};
+use log::warn;
 use matrix_sdk::api::r0::sync::sync_events::JoinedRoom;
 use matrix_sdk::api::r0::sync::sync_events::Response as SyncResponse;
 use matrix_sdk::events::AnyEphemeralRoomEventContent;
@@ -201,34 +201,24 @@ fn get_sync_updates(join: &BTreeMap<RoomId, JoinedRoom>, user_id: &UserId) -> Sy
                 }
             })
             .filter_map(Result::ok)
-            .filter_map(|(room_id, event)| {
-                match event {
-                    AnySyncRoomEvent::State(AnySyncStateEvent::RoomName(ev)) => {
-                        let name = ev.content.name().map(Into::into).unwrap_or_default();
-                        Some(RoomElement::Name(room_id, name))
-                    }
-                    AnySyncRoomEvent::State(AnySyncStateEvent::RoomTopic(ev)) => {
-                        Some(RoomElement::Topic(room_id, ev.content.topic))
-                    }
-                    AnySyncRoomEvent::State(AnySyncStateEvent::RoomAvatar(_)) => {
-                        Some(RoomElement::NewAvatar(room_id))
-                    }
-                    AnySyncRoomEvent::State(AnySyncStateEvent::RoomMember(ev)) => {
-                        Some(RoomElement::MemberEvent(ev.into_full_event(room_id)))
-                    }
-                    AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomRedaction(ev)) => {
-                        Some(RoomElement::RemoveMessage(room_id, ev.redacts))
-                    }
-                    AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomMessage(_)) => None,
-                    AnySyncRoomEvent::Message(AnySyncMessageEvent::Sticker(_)) => {
-                        // This event is managed in the room list
-                        None
-                    }
-                    ev => {
-                        error!("EVENT NOT MANAGED: {:?}", ev);
-                        None
-                    }
+            .filter_map(|(room_id, event)| match event {
+                AnySyncRoomEvent::State(AnySyncStateEvent::RoomName(ev)) => {
+                    let name = ev.content.name().map(Into::into).unwrap_or_default();
+                    Some(RoomElement::Name(room_id, name))
+                }
+                AnySyncRoomEvent::State(AnySyncStateEvent::RoomTopic(ev)) => {
+                    Some(RoomElement::Topic(room_id, ev.content.topic))
+                }
+                AnySyncRoomEvent::State(AnySyncStateEvent::RoomAvatar(_)) => {
+                    Some(RoomElement::NewAvatar(room_id))
+                }
+                AnySyncRoomEvent::State(AnySyncStateEvent::RoomMember(ev)) => {
+                    Some(RoomElement::MemberEvent(ev.into_full_event(room_id)))
+                }
+                AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomRedaction(ev)) => {
+                    Some(RoomElement::RemoveMessage(room_id, ev.redacts))
                 }
+                _ => None,
             })
             .collect(),
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]