Skip to content

Commit

Permalink
Use ignoreSelfEvent in the RoomListStore (which doesn't work!)
Browse files Browse the repository at this point in the history
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
  • Loading branch information
SimonBrandner committed Aug 12, 2021
1 parent f2dccbc commit 0a4a150
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/stores/room-list/RoomListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -270,6 +271,9 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
// 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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 0a4a150

Please sign in to comment.