From 7963ed6d047536dfa545a0ff11c332eba7476072 Mon Sep 17 00:00:00 2001
From: Travis Ralston <travpc@gmail.com>
Date: Tue, 7 Jul 2020 13:42:15 -0600
Subject: [PATCH 1/4] Mute "Unknown room caused setting update" spam

See comment enclosed within.

Fixes https://github.com/vector-im/riot-web/issues/14254
---
 src/settings/handlers/RoomSettingsHandler.js | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/settings/handlers/RoomSettingsHandler.js b/src/settings/handlers/RoomSettingsHandler.js
index d8e775742c..00dd5b8bec 100644
--- a/src/settings/handlers/RoomSettingsHandler.js
+++ b/src/settings/handlers/RoomSettingsHandler.js
@@ -43,11 +43,14 @@ export default class RoomSettingsHandler extends MatrixClientBackedSettingsHandl
         const roomId = event.getRoomId();
         const room = this.client.getRoom(roomId);
 
-        // Note: the tests often fire setting updates that don't have rooms in the store, so
-        // we fail softly here. We shouldn't assume that the state being fired is current
-        // state, but we also don't need to explode just because we didn't find a room.
-        if (!room) console.warn(`Unknown room caused setting update: ${roomId}`);
-        if (room && state !== room.currentState) return; // ignore state updates which are not current
+        // Note: in tests and during the encryption setup on initial load we might not have
+        // rooms in the store, so we just quietly ignore the problem. If we log it then we'll
+        // just end up spamming the logs a few thousand times. It is perfectly fine for us
+        // to ignore the problem as the app will not have loaded enough to care yet.
+        if (!room) return;
+
+        // ignore state updates which are not current
+        if (room && state !== room.currentState) return;
 
         if (event.getType() === "org.matrix.room.preview_urls") {
             let val = event.getContent()['disable'];

From be1b2fddafd7a3588bbbd3e7709540b04a550a8c Mon Sep 17 00:00:00 2001
From: Travis Ralston <travpc@gmail.com>
Date: Tue, 7 Jul 2020 13:46:10 -0600
Subject: [PATCH 2/4] Ensure DMs are not lost in the new room list

Fixes https://github.com/vector-im/riot-web/issues/14236
---
 src/stores/room-list/algorithms/Algorithm.ts | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/stores/room-list/algorithms/Algorithm.ts b/src/stores/room-list/algorithms/Algorithm.ts
index d5f2ed0053..41066fc14b 100644
--- a/src/stores/room-list/algorithms/Algorithm.ts
+++ b/src/stores/room-list/algorithms/Algorithm.ts
@@ -530,9 +530,11 @@ export class Algorithm extends EventEmitter {
             }
 
             if (!inTag) {
-                // TODO: Determine if DM and push there instead: https://github.com/vector-im/riot-web/issues/14236
-                newTags[DefaultTagID.Untagged].push(room);
-
+                if (DMRoomMap.getUserIdForRoomId(room.roomId)) {
+                    newTags[DefaultTagID.DM].push(room);
+                } else {
+                    newTags[DefaultTagID.Untagged].push(room);
+                }
                 // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
                 console.log(`[DEBUG] "${room.name}" (${room.roomId}) is Untagged`);
             }

From 2488520263d0097f6a08fefd98f1540de7bc8839 Mon Sep 17 00:00:00 2001
From: Travis Ralston <travpc@gmail.com>
Date: Tue, 7 Jul 2020 13:46:29 -0600
Subject: [PATCH 3/4] Clean up tag logging in setKnownRooms

We don't need this anymore
---
 src/stores/room-list/algorithms/Algorithm.ts | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/src/stores/room-list/algorithms/Algorithm.ts b/src/stores/room-list/algorithms/Algorithm.ts
index 41066fc14b..e70d7d468e 100644
--- a/src/stores/room-list/algorithms/Algorithm.ts
+++ b/src/stores/room-list/algorithms/Algorithm.ts
@@ -501,13 +501,9 @@ export class Algorithm extends EventEmitter {
         // Split out the easy rooms first (leave and invite)
         const memberships = splitRoomsByMembership(rooms);
         for (const room of memberships[EffectiveMembership.Invite]) {
-            // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
-            console.log(`[DEBUG] "${room.name}" (${room.roomId}) is an Invite`);
             newTags[DefaultTagID.Invite].push(room);
         }
         for (const room of memberships[EffectiveMembership.Leave]) {
-            // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
-            console.log(`[DEBUG] "${room.name}" (${room.roomId}) is Historical`);
             newTags[DefaultTagID.Archived].push(room);
         }
 
@@ -518,11 +514,7 @@ export class Algorithm extends EventEmitter {
             let inTag = false;
             if (tags.length > 0) {
                 for (const tag of tags) {
-                    // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
-                    console.log(`[DEBUG] "${room.name}" (${room.roomId}) is tagged as ${tag}`);
                     if (!isNullOrUndefined(newTags[tag])) {
-                        // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
-                        console.log(`[DEBUG] "${room.name}" (${room.roomId}) is tagged with VALID tag ${tag}`);
                         newTags[tag].push(room);
                         inTag = true;
                     }
@@ -535,8 +527,6 @@ export class Algorithm extends EventEmitter {
                 } else {
                     newTags[DefaultTagID.Untagged].push(room);
                 }
-                // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
-                console.log(`[DEBUG] "${room.name}" (${room.roomId}) is Untagged`);
             }
         }
 

From 34ea8342fb3654f5a18ec07df5137a4159f9cc8a Mon Sep 17 00:00:00 2001
From: Travis Ralston <travpc@gmail.com>
Date: Tue, 7 Jul 2020 13:49:36 -0600
Subject: [PATCH 4/4] Remove comment claiming encrypted rooms are handled
 incorrectly

Fixes https://github.com/vector-im/riot-web/issues/14238

The encrypted rooms are loaded on startup (eventually), so we don't need to worry about the problem described.
---
 src/stores/room-list/RoomListStore2.ts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/stores/room-list/RoomListStore2.ts b/src/stores/room-list/RoomListStore2.ts
index e5205f6051..60174b63c8 100644
--- a/src/stores/room-list/RoomListStore2.ts
+++ b/src/stores/room-list/RoomListStore2.ts
@@ -221,9 +221,6 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
             }
             // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
             console.log(`[RoomListDebug] Decrypted timeline event ${eventPayload.event.getId()} in ${roomId}`);
-            // TODO: Verify that e2e rooms are handled on init: https://github.com/vector-im/riot-web/issues/14238
-            // It seems like when viewing the room the timeline is decrypted, rather than at startup. This could
-            // cause inaccuracies with the list ordering. We may have to decrypt the last N messages of every room :(
             await this.handleRoomUpdate(room, RoomUpdateCause.Timeline);
         } else if (payload.action === 'MatrixActions.accountData' && payload.event_type === 'm.direct') {
             const eventPayload = (<any>payload); // TODO: Type out the dispatcher types