From 0465815486fd1afdcbf6bae3536d33b20d7c00a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 25 Aug 2021 08:43:13 +0200 Subject: [PATCH] ignoreSelfEvent -> shouldCauseReorder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- .../algorithms/tag-sorting/RecentAlgorithm.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts b/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts index 5ddfd96c8a..08f9f6efd5 100644 --- a/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts +++ b/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts @@ -23,21 +23,21 @@ import { EffectiveMembership, getEffectiveMembership } from "../../../../utils/m import { EventType } from "matrix-js-sdk/src/@types/event"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; -export function ignoreSelfEvent(event: MatrixEvent): boolean { +export function shouldCauseReorder(event: MatrixEvent): boolean { const type = event.getType(); const content = event.getContent(); const prevContent = event.getPrevContent(); // Never ignore membership changes - if (type === EventType.RoomMember && prevContent.membership !== content.membership) return false; + if (type === EventType.RoomMember && prevContent.membership !== content.membership) return true; // Ignore status changes // XXX: This should be an enum - if (type === "im.vector.user_status") return true; + if (type === "im.vector.user_status") return false; // Ignore display name changes - if (type === EventType.RoomMember && prevContent.displayname !== content.displayname) return true; + if (type === EventType.RoomMember && prevContent.displayname !== content.displayname) return false; - return false; + return true; } export const sortRooms = (rooms: Room[]): Room[] => { @@ -88,7 +88,7 @@ export const sortRooms = (rooms: Room[]): Room[] => { if (!ev.getTs()) continue; // skip events that don't have timestamps (tests only?) if ( - (ev.getSender() === myUserId && !ignoreSelfEvent(ev)) || + (ev.getSender() === myUserId && shouldCauseReorder(ev)) || Unread.eventTriggersUnreadCount(ev) ) { return ev.getTs();