From 3a41206e904b59bec67af9f6f1f81494d2613e84 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 14:53:52 +0000 Subject: [PATCH 1/7] Fix the ctrl+k shortcut Fixes https://github.com/vector-im/riot-web/issues/9029 --- src/components/structures/LeftPanel.js | 1 + src/components/structures/SearchBox.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/components/structures/LeftPanel.js b/src/components/structures/LeftPanel.js index 7088347ff4..21438c597c 100644 --- a/src/components/structures/LeftPanel.js +++ b/src/components/structures/LeftPanel.js @@ -213,6 +213,7 @@ const LeftPanel = React.createClass({ ); const searchBox = ( Date: Fri, 1 Mar 2019 15:48:10 -0700 Subject: [PATCH 2/7] Always insert rooms into lists when they get lost Room upgrades, direct chats, etc all end up being lost in these scenarios. Instead of losing them to the list, try and put them into a relevant spot of the list. Fixes https://github.com/vector-im/riot-web/issues/9020 --- src/stores/RoomListStore.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index e9ac33b506..fc140f31e6 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -477,18 +477,12 @@ class RoomListStore extends Store { room, category, this._state.lists[key], listsClone[key], lastTimestamp); if (!pushedEntry) { - // Special case invites: they don't really have timelines and can easily get lost when - // the user has multiple pending invites. Pushing them is the least worst option. - if (listsClone[key].length === 0 || key === "im.vector.fake.invite") { - listsClone[key].push({room, category}); - insertedIntoTags.push(key); - } else { - // In theory, this should never happen - console.warn(`!! Room ${room.roomId} lost: No position available`); - } - } else { - insertedIntoTags.push(key); + // There's some circumstances where the room doesn't fit anywhere, so just + // push the room in. We push it in at the start of the list because the room + // is probably important. + listsClone[key].splice(0, 0, {room, category}); } + insertedIntoTags.push(key); } } From 2ad11437d51e587ab35a061e64e59e38b05db5f2 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 1 Mar 2019 17:18:16 -0700 Subject: [PATCH 3/7] More clearly fix issues with room insertion to lists Instead of having a catch-all insert, try and fix the common cases with a bit more care. --- src/stores/RoomListStore.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index fc140f31e6..78e0659e36 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -429,6 +429,13 @@ class RoomListStore extends Store { newList.push(entry); } + if (!pushedEntry && desiredCategoryBoundaryIndex >= 0) { + console.warn(`!! Room ${room.roomId} nearly lost: Ran off the end of the list`); + console.warn(`!! Inserting at position ${desiredCategoryBoundaryIndex} with category ${category}`); + newList.splice(desiredCategoryBoundaryIndex, 0, {room, category}); + pushedEntry = true; + } + return pushedEntry; } @@ -477,16 +484,27 @@ class RoomListStore extends Store { room, category, this._state.lists[key], listsClone[key], lastTimestamp); if (!pushedEntry) { - // There's some circumstances where the room doesn't fit anywhere, so just - // push the room in. We push it in at the start of the list because the room - // is probably important. + // This should rarely happen: _slotRoomIntoList has several checks which attempt + // to make sure that a room is not lost in the list. If we do lose the room though, + // we shouldn't throw it on the floor and forget about it. Instead, we should insert + // it somewhere. We'll insert it at the top for a couple reasons: 1) it is probably + // an important room for the user and 2) if this does happen, we'd want a bug report. + console.warn(`!! Room ${room.roomId} nearly lost: Failed to find a position`); + console.warn(`!! Inserting at position 0 in the list and flagging as inserted`); + console.warn("!! Additional info: ", { + category, + key, + upToIndex: listsClone[key].length, + expectedCount: this._state.lists[key].length, + }); listsClone[key].splice(0, 0, {room, category}); } insertedIntoTags.push(key); } } - // Double check that we inserted the room in the right places + // Double check that we inserted the room in the right places. + // There should never be a discrepancy. for (const targetTag of targetTags) { let count = 0; for (const insertedTag of insertedIntoTags) { From ff72c3ba630e1889124cfd3c78ad3d69eb6c03a3 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 4 Mar 2019 10:56:18 -0700 Subject: [PATCH 4/7] Include tag name when warning about rooms running off lists --- src/stores/RoomListStore.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index 78e0659e36..e06592903f 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -332,7 +332,7 @@ class RoomListStore extends Store { return tags; } - _slotRoomIntoList(room, category, existingEntries, newList, lastTimestampFn) { + _slotRoomIntoList(room, category, tag, existingEntries, newList, lastTimestampFn) { const targetCategoryIndex = CATEGORY_ORDER.indexOf(category); // The slotting algorithm works by trying to position the room in the most relevant @@ -430,7 +430,7 @@ class RoomListStore extends Store { } if (!pushedEntry && desiredCategoryBoundaryIndex >= 0) { - console.warn(`!! Room ${room.roomId} nearly lost: Ran off the end of the list`); + console.warn(`!! Room ${room.roomId} nearly lost: Ran off the end of ${tag}`); console.warn(`!! Inserting at position ${desiredCategoryBoundaryIndex} with category ${category}`); newList.splice(desiredCategoryBoundaryIndex, 0, {room, category}); pushedEntry = true; @@ -481,7 +481,7 @@ class RoomListStore extends Store { listsClone[key] = []; const pushedEntry = this._slotRoomIntoList( - room, category, this._state.lists[key], listsClone[key], lastTimestamp); + room, category, key, this._state.lists[key], listsClone[key], lastTimestamp); if (!pushedEntry) { // This should rarely happen: _slotRoomIntoList has several checks which attempt From 2cd6d1ec6aa970492e9c7dd7af995ae73d967b63 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 1 Mar 2019 15:29:24 -0700 Subject: [PATCH 5/7] Don't duplicate direct chats from other tags Fixes https://github.com/vector-im/riot-web/issues/8971 --- src/stores/RoomListStore.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index e06592903f..fe3caaca9c 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -319,7 +319,9 @@ class RoomListStore extends Store { const dmRoomMap = DMRoomMap.shared(); if (myMembership === 'invite') { tags.push("im.vector.fake.invite"); - } else if (dmRoomMap.getUserIdForRoomId(room.roomId)) { + } else if (dmRoomMap.getUserIdForRoomId(room.roomId) && tags.length === 0) { + // We intentionally don't duplicate rooms in other tags into the people list + // as a feature. tags.push("im.vector.fake.direct"); } else if (tags.length === 0) { tags.push("im.vector.fake.recent"); From e78ba0b7721b21de9e1fd0a6f33cf31461ba6fc6 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 15:46:17 +0000 Subject: [PATCH 6/7] Prepare changelog for v1.0.3 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de71e5578e..3f237dcaea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +Changes in [1.0.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.3) (2019-03-06) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2...v1.0.3) + + * Don't duplicate direct chats from other tags + [\#2762](https://github.com/matrix-org/matrix-react-sdk/pull/2762) + * Include tag name when warning about rooms running off lists + [\#2761](https://github.com/matrix-org/matrix-react-sdk/pull/2761) + * Always insert rooms into lists when they get lost + [\#2760](https://github.com/matrix-org/matrix-react-sdk/pull/2760) + * Fix the ctrl+k shortcut + [\#2759](https://github.com/matrix-org/matrix-react-sdk/pull/2759) + Changes in [1.0.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2) (2019-03-06) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.4...v1.0.2) From d46b9dab87b34c5a6ef173534c169e0a6d3aa46d Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 15:46:47 +0000 Subject: [PATCH 7/7] v1.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d911e41354..124841ef1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.0.2", + "version": "1.0.3", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {