From 0a4a1506d412cdec610196af73fca6401fead15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 12 Aug 2021 09:40:26 +0200 Subject: [PATCH] Use ignoreSelfEvent in the RoomListStore (which doesn't work!) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/stores/room-list/RoomListStore.ts | 4 ++++ .../room-list/algorithms/tag-sorting/RecentAlgorithm.ts | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/stores/room-list/RoomListStore.ts b/src/stores/room-list/RoomListStore.ts index 1a5ef0484e..6a80bcd1e5 100644 --- a/src/stores/room-list/RoomListStore.ts +++ b/src/stores/room-list/RoomListStore.ts @@ -38,6 +38,7 @@ import { SpaceWatcher } from "./SpaceWatcher"; import SpaceStore from "../SpaceStore"; import { Action } from "../../dispatcher/actions"; import { SettingUpdatedPayload } from "../../dispatcher/payloads/SettingUpdatedPayload"; +import { ignoreSelfEvent } from "./algorithms/tag-sorting/RecentAlgorithm"; interface IState { tagsEnabled?: boolean; @@ -270,6 +271,9 @@ export class RoomListStoreClass extends AsyncStoreWithClient { // Ignore non-live events (backfill) if (!eventPayload.isLiveEvent || !payload.isLiveUnfilteredRoomTimelineEvent) return; + // Avoid re-ordering on status, profile etc. changes + if (ignoreSelfEvent(eventPayload.event)) return; + const roomId = eventPayload.event.getRoomId(); const room = this.matrixClient.getRoom(roomId); const tryUpdate = async (updatedRoom: Room) => { diff --git a/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts b/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts index 5ddfd96c8a..bbfac876bc 100644 --- a/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts +++ b/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts @@ -87,10 +87,7 @@ export const sortRooms = (rooms: Room[]): Room[] => { const ev = r.timeline[i]; if (!ev.getTs()) continue; // skip events that don't have timestamps (tests only?) - if ( - (ev.getSender() === myUserId && !ignoreSelfEvent(ev)) || - Unread.eventTriggersUnreadCount(ev) - ) { + if (ev.getSender() === myUserId || Unread.eventTriggersUnreadCount(ev)) { return ev.getTs(); } }