@@ -193,6 +193,18 @@ extension RoomExtension on Room {
193193 if (b.shouldHideChangedDisplayNameEvent ()) {
194194 return a;
195195 }
196+ // hide reaction events
197+ if (a.type == EventTypes .Reaction ||
198+ a.relationshipType == RelationshipTypes .reaction) {
199+ return b;
200+ }
201+ if (b.type == EventTypes .Reaction ||
202+ b.relationshipType == RelationshipTypes .reaction) {
203+ return a;
204+ }
205+ // hide pinned message events
206+ if (a.type == EventTypes .RoomPinnedEvents ) return b;
207+ if (b.type == EventTypes .RoomPinnedEvents ) return a;
196208 if (a.originServerTs == b.originServerTs) {
197209 // if two events have the same sort order we want to give encrypted events a lower priority
198210 // This is so that if the same event exists in the state both encrypted *and* unencrypted,
@@ -207,7 +219,11 @@ extension RoomExtension on Room {
207219
208220 if (lastEventAvailableInPreview == null ||
209221 lastEventAvailableInPreview.shouldHideRedactedEvent () ||
210- lastEventAvailableInPreview.shouldHideBannedEvent ()) {
222+ lastEventAvailableInPreview.shouldHideBannedEvent () ||
223+ lastEventAvailableInPreview.type == EventTypes .Reaction ||
224+ lastEventAvailableInPreview.relationshipType ==
225+ RelationshipTypes .reaction ||
226+ lastEventAvailableInPreview.type == EventTypes .RoomPinnedEvents ) {
211227 final lastState = _getLastestRoomState ();
212228
213229 if (lastState == null ) return null ;
@@ -226,6 +242,13 @@ extension RoomExtension on Room {
226242 if (messageEvent.shouldHideBannedEvent ()) continue ;
227243 if (messageEvent.shouldHideChangedAvatarEvent ()) continue ;
228244 if (messageEvent.shouldHideChangedDisplayNameEvent ()) continue ;
245+ // hide reaction events
246+ if (messageEvent.type == EventTypes .Reaction ) continue ;
247+ if (messageEvent.relationshipType == RelationshipTypes .reaction) {
248+ continue ;
249+ }
250+ // hide pinned message events
251+ if (messageEvent.type == EventTypes .RoomPinnedEvents ) continue ;
229252
230253 if (messageEvent.originServerTs.millisecondsSinceEpoch >
231254 lastState.originServerTs.millisecondsSinceEpoch) {
@@ -250,6 +273,11 @@ extension RoomExtension on Room {
250273 if (state is ! Event ) return ;
251274 if (state.shouldHideRedactedEvent ()) return ;
252275 if (state.shouldHideBannedEvent ()) return ;
276+ // hide reaction events
277+ if (state.type == EventTypes .Reaction ) return ;
278+ if (state.relationshipType == RelationshipTypes .reaction) return ;
279+ // hide pinned message events
280+ if (state.type == EventTypes .RoomPinnedEvents ) return ;
253281 if (state.originServerTs.millisecondsSinceEpoch >
254282 lastTime.millisecondsSinceEpoch) {
255283 lastTime = state.originServerTs;
0 commit comments