From 45f5abb33d9b16b986c06e37585fdd99fa5bfa90 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 16 Apr 2024 12:18:27 +0000 Subject: [PATCH 01/39] Upgrade dependency to matrix-js-sdk@32.1.0-rc.0 --- package.json | 2 +- yarn.lock | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 42a48823f7..5ad5f6957b 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "maplibre-gl": "^2.0.0", "matrix-encrypt-attachment": "^1.0.3", "matrix-events-sdk": "0.0.1", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", + "matrix-js-sdk": "32.1.0-rc.0", "matrix-widget-api": "^1.5.0", "memoize-one": "^6.0.0", "minimist": "^1.2.5", diff --git a/yarn.lock b/yarn.lock index eb58c72309..feec8dade0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7015,9 +7015,10 @@ matrix-events-sdk@0.0.1: resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz#c8c38911e2cb29023b0bbac8d6f32e0de2c957dd" integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA== -"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": - version "32.0.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/82ed7bd86ae4c8c703f886a490573110035cfe34" +matrix-js-sdk@32.1.0-rc.0: + version "32.1.0-rc.0" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-32.1.0-rc.0.tgz#9786ff9ce82771300ea9ca60fcb91e618a8c6c1f" + integrity sha512-4SKRE0ECroXJwC+GDbgo8W+Qnwbl69fIUToHGkLkIIcybDXc0uQaoGrudHo/6BtafXn2HphbFz60z+5/5bXWqg== dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-wasm" "^4.9.0" From 11a0422b91e5366fcc7b5c1d2112db5d053a0d1a Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 16 Apr 2024 12:22:19 +0000 Subject: [PATCH 02/39] v3.98.0-rc.0 --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5ad5f6957b..2e217dee85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.97.0", + "version": "3.98.0-rc.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { @@ -23,7 +23,7 @@ "package.json", ".stylelintrc.js" ], - "main": "./src/index.ts", + "main": "./lib/index.ts", "matrix_src_main": "./src/index.ts", "matrix_lib_main": "./lib/index.ts", "matrix_lib_typings": "./lib/index.d.ts", @@ -233,5 +233,6 @@ "outputDirectory": "coverage", "outputName": "jest-sonar-report.xml", "relativePaths": true - } + }, + "typings": "./lib/index.d.ts" } From 6dd6a7697c2d09d9dd2d7803725bc8420a65b48c Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Mon, 22 Apr 2024 10:52:50 +0200 Subject: [PATCH 03/39] Decrypt events in reverse order without copying the array (#12445) Signed-off-by: Johannes Marbach --- src/components/structures/TimelinePanel.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index ba3c4d203b..288c65972f 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -54,7 +54,6 @@ import dis from "../../dispatcher/dispatcher"; import { Action } from "../../dispatcher/actions"; import Timer from "../../utils/Timer"; import shouldHideEvent from "../../shouldHideEvent"; -import { arrayFastClone } from "../../utils/arrays"; import MessagePanel from "./MessagePanel"; import { IScrollState } from "./ScrollPanel"; import { ActionPayload } from "../../dispatcher/payloads"; @@ -1754,15 +1753,11 @@ class TimelinePanel extends React.Component { [...mainEvents], ); - // `arrayFastClone` performs a shallow copy of the array - // we want the last event to be decrypted first but displayed last - // `reverse` is destructive and unfortunately mutates the "events" array - arrayFastClone(events) - .reverse() - .forEach((event) => { - const client = MatrixClientPeg.safeGet(); - client.decryptEventIfNeeded(event); - }); + // We want the last event to be decrypted first + const client = MatrixClientPeg.safeGet(); + for (let i = events.length - 1; i >= 0; --i) { + client.decryptEventIfNeeded(events[i]); + } const firstVisibleEventIndex = this.checkForPreJoinUISI(events); From 427be433d0764041dc783763561582ec11bcf102 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 22 Apr 2024 17:15:29 +0100 Subject: [PATCH 04/39] Add analytics to activity toggles (#12418) * Add analytics to activity toggles Requires https://github.com/matrix-org/matrix-analytics-events/pull/101 * Add test * Fix comment a bit * Update to new analytics events package --- src/settings/Settings.tsx | 3 ++ .../controllers/AnalyticsController.ts | 42 +++++++++++++++++++ .../controllers/AnalyticsController-test.ts | 35 ++++++++++++++++ yarn.lock | 37 +++------------- 4 files changed, 86 insertions(+), 31 deletions(-) create mode 100644 src/settings/controllers/AnalyticsController.ts create mode 100644 test/settings/controllers/AnalyticsController-test.ts diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 6be0a6b46f..c5ae541610 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -47,6 +47,7 @@ import ServerSupportUnstableFeatureController from "./controllers/ServerSupportU import { WatchManager } from "./WatchManager"; import { CustomTheme } from "../theme"; import SettingsStore from "./SettingsStore"; +import AnalyticsController from "./controllers/AnalyticsController"; export const defaultWatchManager = new WatchManager(); @@ -597,11 +598,13 @@ export const SETTINGS: { [setting: string]: ISetting } = { displayName: _td("settings|showbold"), default: false, invertedSettingName: "feature_hidebold", + controller: new AnalyticsController("WebSettingsNotificationsShowBoldToggle"), }, "Notifications.tac_only_notifications": { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, displayName: _td("settings|tac_only_notifications"), default: true, + controller: new AnalyticsController("WebSettingsNotificationsTACOnlyNotificationsToggle"), }, "feature_ask_to_join": { isFeature: true, diff --git a/src/settings/controllers/AnalyticsController.ts b/src/settings/controllers/AnalyticsController.ts new file mode 100644 index 0000000000..5c127ed3b9 --- /dev/null +++ b/src/settings/controllers/AnalyticsController.ts @@ -0,0 +1,42 @@ +/* +Copyright 2024 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import SettingController from "./SettingController"; +import { SettingLevel } from "../SettingLevel"; +import PosthogTrackers, { InteractionName } from "../../PosthogTrackers"; + +/** + * Controller that sends events to analytics when a setting is changed. + * Since it will only trigger events when the setting is changed, + * (and the value isn't reported: only the fact that it's been toggled) + * it won't be useful for tracking what percentage of a userbase has a given setting + * enabled, but many of our settings can be set per device and Posthog only supports + * per-user properties, so this isn't straightforward. This is only for seeing how + * often people interact with the settings. + */ +export default class AnalyticsController extends SettingController { + /** + * + * @param interactionName The name of the event to send to analytics + */ + public constructor(private interactionName: InteractionName) { + super(); + } + + public onChange(_level: SettingLevel, _roomId: string | null, _newValue: any): void { + PosthogTrackers.trackInteraction(this.interactionName); + } +} diff --git a/test/settings/controllers/AnalyticsController-test.ts b/test/settings/controllers/AnalyticsController-test.ts new file mode 100644 index 0000000000..69b624994e --- /dev/null +++ b/test/settings/controllers/AnalyticsController-test.ts @@ -0,0 +1,35 @@ +/* +Copyright 2024 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import PosthogTrackers from "../../../src/PosthogTrackers"; +import AnalyticsController from "../../../src/settings/controllers/AnalyticsController"; +import { SettingLevel } from "../../../src/settings/SettingLevel"; + +describe("AnalyticsController", () => { + afterEach(() => { + jest.restoreAllMocks(); + }); + + it("Tracks a Posthog interaction on change", () => { + const trackInteractionSpy = jest.spyOn(PosthogTrackers, "trackInteraction"); + + const controller = new AnalyticsController("WebSettingsNotificationsTACOnlyNotificationsToggle"); + + controller.onChange(SettingLevel.DEVICE, null, false); + + expect(trackInteractionSpy).toHaveBeenCalledWith("WebSettingsNotificationsTACOnlyNotificationsToggle"); + }); +}); diff --git a/yarn.lock b/yarn.lock index f89fd40bf9..6d4ff9f1ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1859,9 +1859,9 @@ integrity sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q== "@matrix-org/analytics-events@^0.19.0": - version "0.19.0" - resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.19.0.tgz#e20e4df54530ed1c755ab728e9c22891e376f9e2" - integrity sha512-wN/hbpTpOxz2u3zHbsJgVMi88oKmK1yqeSZuif3yNW68XQnV2cc0XGUEpl0fgLOl6fj1bZOtxbDg5rCLbqf4CQ== + version "0.19.1" + resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.19.1.tgz#304d48b7b8e51117dfd9c1cf46a65e8bee9f46cb" + integrity sha512-bYWJIkOzl4Jt02fg1+XoQv5xZ3mP6qBzNmytt1UVfKLaGgLBSvlk9gXx2/3GhSuPBq99/CljEX/zABJ//mexAw== "@matrix-org/emojibase-bindings@^1.1.2": version "1.1.3" @@ -8652,16 +8652,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -8755,14 +8746,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -9555,7 +9539,7 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -9573,15 +9557,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From c3f8189f0f84b9eb8236f6a703e44c37af7a1674 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 23 Apr 2024 12:35:46 +0000 Subject: [PATCH 05/39] Upgrade dependency to matrix-js-sdk@32.1.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2e217dee85..fecdbfc329 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "maplibre-gl": "^2.0.0", "matrix-encrypt-attachment": "^1.0.3", "matrix-events-sdk": "0.0.1", - "matrix-js-sdk": "32.1.0-rc.0", + "matrix-js-sdk": "32.1.0", "matrix-widget-api": "^1.5.0", "memoize-one": "^6.0.0", "minimist": "^1.2.5", diff --git a/yarn.lock b/yarn.lock index feec8dade0..ba6d734737 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7015,10 +7015,10 @@ matrix-events-sdk@0.0.1: resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz#c8c38911e2cb29023b0bbac8d6f32e0de2c957dd" integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA== -matrix-js-sdk@32.1.0-rc.0: - version "32.1.0-rc.0" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-32.1.0-rc.0.tgz#9786ff9ce82771300ea9ca60fcb91e618a8c6c1f" - integrity sha512-4SKRE0ECroXJwC+GDbgo8W+Qnwbl69fIUToHGkLkIIcybDXc0uQaoGrudHo/6BtafXn2HphbFz60z+5/5bXWqg== +matrix-js-sdk@32.1.0: + version "32.1.0" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-32.1.0.tgz#b5cb79cc838c450d44d01de1ac58b6cda63b20b9" + integrity sha512-+jRCQKOBuMvAz3nWsf5NGWpttByeC/gw1It1gCZLQsWix6jN1bkHiqwk6OOvcGj4I5ML2bOEbYEr46bcqFUouQ== dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-wasm" "^4.9.0" From 0c40f6d26f1662914521ed56507987149b462733 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 23 Apr 2024 12:56:04 +0000 Subject: [PATCH 06/39] v3.98.0 --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b21e44fd11..440239db81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +Changes in [3.98.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.98.0) (2024-04-23) +===================================================================================================== +## ✨ Features + +* Make empty state copy for TAC depend on the value of the setting ([#12419](https://github.com/matrix-org/matrix-react-sdk/pull/12419)). Contributed by @dbkr. +* Linkify User Interactive Authentication errors ([#12271](https://github.com/matrix-org/matrix-react-sdk/pull/12271)). Contributed by @t3chguy. +* Add support for device dehydration v2 ([#12316](https://github.com/matrix-org/matrix-react-sdk/pull/12316)). Contributed by @uhoreg. +* Replace `SecurityCustomisations` with `CryptoSetupExtension` ([#12342](https://github.com/matrix-org/matrix-react-sdk/pull/12342)). Contributed by @thoraj. +* Add activity toggle for TAC ([#12413](https://github.com/matrix-org/matrix-react-sdk/pull/12413)). Contributed by @dbkr. +* Humanize spell check language labels ([#12409](https://github.com/matrix-org/matrix-react-sdk/pull/12409)). Contributed by @t3chguy. +* Call Guest Access, give user the option to change the acces level so they can generate a call link. ([#12401](https://github.com/matrix-org/matrix-react-sdk/pull/12401)). Contributed by @toger5. +* TAC: Release Announcement ([#12380](https://github.com/matrix-org/matrix-react-sdk/pull/12380)). Contributed by @florianduros. +* Show the call and share button if the user can create a guest link. ([#12385](https://github.com/matrix-org/matrix-react-sdk/pull/12385)). Contributed by @toger5. +* Add analytics for mark all threads unread ([#12384](https://github.com/matrix-org/matrix-react-sdk/pull/12384)). Contributed by @dbkr. +* Add `EventType.RoomEncryption` to the auto approve capabilities of Element Call widgets ([#12386](https://github.com/matrix-org/matrix-react-sdk/pull/12386)). Contributed by @toger5. + +## 🐛 Bug Fixes + +* Fix link modal not shown after access upgrade ([#12411](https://github.com/matrix-org/matrix-react-sdk/pull/12411)). Contributed by @toger5. +* Fix thread navigation in timeline ([#12412](https://github.com/matrix-org/matrix-react-sdk/pull/12412)). Contributed by @florianduros. +* Fix inability to join a `knock` room via space hierarchy view ([#12404](https://github.com/matrix-org/matrix-react-sdk/pull/12404)). Contributed by @t3chguy. +* Focus the thread panel when clicking on an item in the TAC ([#12410](https://github.com/matrix-org/matrix-react-sdk/pull/12410)). Contributed by @dbkr. +* Fix space hierarchy tile busy state being stuck after join error ([#12405](https://github.com/matrix-org/matrix-react-sdk/pull/12405)). Contributed by @t3chguy. +* Fix room topic in-app links not being handled correctly on topic dialog ([#12406](https://github.com/matrix-org/matrix-react-sdk/pull/12406)). Contributed by @t3chguy. + + Changes in [3.97.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.97.0) (2024-04-09) ===================================================================================================== ## ✨ Features diff --git a/package.json b/package.json index fecdbfc329..b889be989d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.98.0-rc.0", + "version": "3.98.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 5f9edc6049c6ddd32918afd5aaf923d31189ebb8 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 23 Apr 2024 12:57:18 +0000 Subject: [PATCH 07/39] Resetting package fields for development --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 519fca6323..c0a17f804a 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "package.json", ".stylelintrc.js" ], - "main": "./lib/index.ts", + "main": "./src/index.ts", "matrix_src_main": "./src/index.ts", "matrix_lib_main": "./lib/index.ts", "matrix_lib_typings": "./lib/index.d.ts", @@ -233,6 +233,5 @@ "outputDirectory": "coverage", "outputName": "jest-sonar-report.xml", "relativePaths": true - }, - "typings": "./lib/index.d.ts" + } } From 33c56e565db5922a7d87089cd2baf8bdadc66434 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 23 Apr 2024 12:57:29 +0000 Subject: [PATCH 08/39] Reset matrix-js-sdk back to develop branch --- package.json | 2 +- yarn.lock | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index c0a17f804a..e19463d337 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "maplibre-gl": "^2.0.0", "matrix-encrypt-attachment": "^1.0.3", "matrix-events-sdk": "0.0.1", - "matrix-js-sdk": "32.1.0", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "matrix-widget-api": "^1.5.0", "memoize-one": "^6.0.0", "minimist": "^1.2.5", diff --git a/yarn.lock b/yarn.lock index 91b1478c99..f9a0ee7e63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7014,10 +7014,9 @@ matrix-events-sdk@0.0.1: resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz#c8c38911e2cb29023b0bbac8d6f32e0de2c957dd" integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA== -matrix-js-sdk@32.1.0: +"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "32.1.0" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-32.1.0.tgz#b5cb79cc838c450d44d01de1ac58b6cda63b20b9" - integrity sha512-+jRCQKOBuMvAz3nWsf5NGWpttByeC/gw1It1gCZLQsWix6jN1bkHiqwk6OOvcGj4I5ML2bOEbYEr46bcqFUouQ== + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/1da5e8f56a29afef0197dd4c3553d2ee4dfbd576" dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-wasm" "^4.9.0" @@ -8653,7 +8652,16 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -8747,7 +8755,14 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -9540,7 +9555,7 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -9558,6 +9573,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 158e1110b16db7b5326ada41226c9da8efb35f02 Mon Sep 17 00:00:00 2001 From: Asim Mohammed Delvi Date: Wed, 24 Apr 2024 14:26:59 +0530 Subject: [PATCH 09/39] Fixed the drag and drop of X ##27186 (#12450) --- src/components/views/rooms/LinkPreviewGroup.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/rooms/LinkPreviewGroup.tsx b/src/components/views/rooms/LinkPreviewGroup.tsx index 0b82b8729a..c940e9fce7 100644 --- a/src/components/views/rooms/LinkPreviewGroup.tsx +++ b/src/components/views/rooms/LinkPreviewGroup.tsx @@ -81,6 +81,7 @@ const LinkPreviewGroup: React.FC = ({ links, mxEvent, onCancelClick, onH src={require("../../../../res/img/cancel.svg").default} width="18" height="18" + draggable="false" /> ) : undefined} From 644bf78e2ac2d152c8a1282ef26c7fa4f2164dee Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 24 Apr 2024 10:22:07 +0100 Subject: [PATCH 10/39] Show the local echo in previews (#12451) * show the local echo in previews * a bit more coverage --- src/stores/room-list/MessagePreviewStore.ts | 19 +++- .../room-list/MessagePreviewStore-test.ts | 99 ++++++++++++++++++- 2 files changed, 114 insertions(+), 4 deletions(-) diff --git a/src/stores/room-list/MessagePreviewStore.ts b/src/stores/room-list/MessagePreviewStore.ts index 647300f99c..a3c44084d5 100644 --- a/src/stores/room-list/MessagePreviewStore.ts +++ b/src/stores/room-list/MessagePreviewStore.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Room, RelationType, MatrixEvent, Thread, M_POLL_START } from "matrix-js-sdk/src/matrix"; +import { Room, RelationType, MatrixEvent, Thread, M_POLL_START, RoomEvent } from "matrix-js-sdk/src/matrix"; import { isNullOrUndefined } from "matrix-js-sdk/src/utils"; import { ActionPayload } from "../../dispatcher/payloads"; @@ -186,7 +186,7 @@ export class MessagePreviewStore extends AsyncStoreWithClient { } private async generatePreview(room: Room, tagId?: TagID): Promise { - const events = [...room.getLiveTimeline().getEvents()]; + const events = [...room.getLiveTimeline().getEvents(), ...room.getPendingEvents()]; // add last reply from each thread room.getThreads().forEach((thread: Thread): void => { @@ -279,4 +279,19 @@ export class MessagePreviewStore extends AsyncStoreWithClient { await this.generatePreview(room, TAG_ANY); } } + + protected async onReady(): Promise { + if (!this.matrixClient) return; + this.matrixClient.on(RoomEvent.LocalEchoUpdated, this.onLocalEchoUpdated); + } + + protected async onNotReady(): Promise { + if (!this.matrixClient) return; + this.matrixClient.off(RoomEvent.LocalEchoUpdated, this.onLocalEchoUpdated); + } + + protected onLocalEchoUpdated = async (ev: MatrixEvent, room: Room): Promise => { + if (!this.previews.has(room.roomId)) return; + await this.generatePreview(room, TAG_ANY); + }; } diff --git a/test/stores/room-list/MessagePreviewStore-test.ts b/test/stores/room-list/MessagePreviewStore-test.ts index cbb045e6e9..5be2c65fd1 100644 --- a/test/stores/room-list/MessagePreviewStore-test.ts +++ b/test/stores/room-list/MessagePreviewStore-test.ts @@ -15,7 +15,16 @@ limitations under the License. */ import { Mocked, mocked } from "jest-mock"; -import { EventTimeline, EventType, MatrixClient, MatrixEvent, RelationType, Room } from "matrix-js-sdk/src/matrix"; +import { + EventStatus, + EventTimeline, + EventType, + MatrixClient, + MatrixEvent, + PendingEventOrdering, + RelationType, + Room, +} from "matrix-js-sdk/src/matrix"; import { MessagePreviewStore } from "../../../src/stores/room-list/MessagePreviewStore"; import { mkEvent, mkMessage, mkReaction, setupAsyncStoreWithClient, stubClient } from "../../test-utils"; @@ -25,6 +34,7 @@ import { mkThread } from "../../test-utils/threads"; describe("MessagePreviewStore", () => { let client: Mocked; let room: Room; + let nonRenderedRoom: Room; let store: MessagePreviewStore; async function addEvent( @@ -46,9 +56,35 @@ describe("MessagePreviewStore", () => { } } + async function addPendingEvent( + store: MessagePreviewStore, + room: Room, + event: MatrixEvent, + fireAction = true, + ): Promise { + room.addPendingEvent(event, "txid"); + if (fireAction) { + // @ts-ignore private access + await store.onLocalEchoUpdated(event, room); + } + } + + async function updatePendingEvent(event: MatrixEvent, eventStatus: EventStatus, fireAction = true): Promise { + room.updatePendingEvent(event, eventStatus); + if (fireAction) { + // @ts-ignore private access + await store.onLocalEchoUpdated(event, room); + } + } + beforeEach(async () => { client = mocked(stubClient()); - room = new Room("!roomId:server", client, client.getSafeUserId()); + room = new Room("!roomId:server", client, client.getSafeUserId(), { + pendingEventOrdering: PendingEventOrdering.Detached, + }); + nonRenderedRoom = new Room("!roomId2:server", client, client.getSafeUserId(), { + pendingEventOrdering: PendingEventOrdering.Detached, + }); mocked(client.getRoom).mockReturnValue(room); store = MessagePreviewStore.testInstance(); @@ -286,4 +322,63 @@ describe("MessagePreviewStore", () => { expect(preview?.isThreadReply).toBe(false); expect(preview?.text).toContain("You reacted 🙃 to root event message"); }); + + it("should handle local echos correctly", async () => { + const firstMessage = mkMessage({ + user: "@sender:server", + event: true, + room: room.roomId, + msg: "First message", + }); + + await addEvent(store, room, firstMessage); + + expect((await store.getPreviewForRoom(room, DefaultTagID.Untagged))?.text).toMatchInlineSnapshot( + `"@sender:server: First message"`, + ); + + const secondMessage = mkMessage({ + user: "@sender:server", + event: true, + room: room.roomId, + msg: "Second message", + }); + secondMessage.status = EventStatus.NOT_SENT; + + await addPendingEvent(store, room, secondMessage); + + expect((await store.getPreviewForRoom(room, DefaultTagID.Untagged))?.text).toMatchInlineSnapshot( + `"@sender:server: Second message"`, + ); + + await updatePendingEvent(secondMessage, EventStatus.CANCELLED); + + expect((await store.getPreviewForRoom(room, DefaultTagID.Untagged))?.text).toMatchInlineSnapshot( + `"@sender:server: First message"`, + ); + }); + + it("should not generate previews for rooms not rendered", async () => { + const firstMessage = mkMessage({ + user: "@sender:server", + event: true, + room: nonRenderedRoom.roomId, + msg: "First message", + }); + + await addEvent(store, room, firstMessage); + + const secondMessage = mkMessage({ + user: "@sender:server", + event: true, + room: nonRenderedRoom.roomId, + msg: "Second message", + }); + secondMessage.status = EventStatus.NOT_SENT; + + await addPendingEvent(store, room, secondMessage); + + // @ts-ignore private access + expect(store.previews.has(nonRenderedRoom.roomId)).toBeFalsy(); + }); }); From 700b3955a4a83460f9bf0b446ed95676e1f6cc8e Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Wed, 24 Apr 2024 14:24:25 +0200 Subject: [PATCH 11/39] Add `Tooltip` to `AccessibleButton` (#12443) * Deprecate AccessibleTooltipButton Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Deprecate AccessibleTooltipButton Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix `UserInfo-test.tsx` * Update `LoginWithQRFlow-test.tsx` snapshot * Remove tooltip provider from test * Fix `AccessibleButton` * Update snapshots * Revert to original import * Use title to populate aria-label * Rollback AccessibleButton or Tooltip changes. Will come in another PR * Rollback en.json change * Update snapshots * Fix `UserInfo` * Update snapshots * Use label instead of title in test * Use label instead of title in TAC test * Use label instead of title in read-receipt test * Remove tooltip for ContextMenu * Add extra information for caption field --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- playwright/e2e/read-receipts/index.ts | 6 ++-- .../spaces/threads-activity-centre/index.ts | 2 +- .../context_menu/ContextMenuButton.tsx | 1 - .../views/elements/AccessibleButton.tsx | 24 +++++++++++++- .../elements/AccessibleTooltipButton.tsx | 3 ++ src/components/views/right_panel/UserInfo.tsx | 7 +++- .../__snapshots__/UserMenu-test.tsx.snap | 1 - .../__snapshots__/DialogSidebar-test.tsx.snap | 6 ++-- .../LeftPanelLiveShareWarning-test.tsx.snap | 3 +- .../RoomLiveShareWarning-test.tsx.snap | 3 +- .../views/elements/AppTile-test.tsx | 8 ++--- .../__snapshots__/AppTile-test.tsx.snap | 25 ++++++++------- .../LocationViewDialog-test.tsx.snap | 6 ++-- .../__snapshots__/ZoomButtons-test.tsx.snap | 6 ++-- .../views/right_panel/UserInfo-test.tsx | 29 +++++++++-------- .../RoomSummaryCard-test.tsx.snap | 3 +- .../__snapshots__/UserInfo-test.tsx.snap | 12 ++++--- .../views/rooms/MemberList-test.tsx | 2 +- .../__snapshots__/MemberTile-test.tsx.snap | 9 ++++-- .../CurrentDeviceSection-test.tsx.snap | 32 ++++++++++++------- .../LoginWithQRFlow-test.tsx.snap | 18 +++++++---- .../PeopleRoomSettingsTab-test.tsx.snap | 12 ++++--- .../SessionManagerTab-test.tsx.snap | 4 +++ .../__snapshots__/SpacePanel-test.tsx.snap | 1 - 24 files changed, 147 insertions(+), 76 deletions(-) diff --git a/playwright/e2e/read-receipts/index.ts b/playwright/e2e/read-receipts/index.ts index 6b9a8381d2..4dd0450fb9 100644 --- a/playwright/e2e/read-receipts/index.ts +++ b/playwright/e2e/read-receipts/index.ts @@ -403,7 +403,7 @@ class Helpers { * tests we only open the threads panel.) */ async closeThreadsPanel() { - await this.page.locator(".mx_RightPanel").getByTitle("Close").click(); + await this.page.locator(".mx_RightPanel").getByLabel("Close").click(); await expect(this.page.locator(".mx_RightPanel")).not.toBeVisible(); } @@ -411,7 +411,7 @@ class Helpers { * Return to the list of threads, given we are viewing a single thread. */ async backToThreadsList() { - await this.page.locator(".mx_RightPanel").getByTitle("Threads").click(); + await this.page.locator(".mx_RightPanel").getByLabel("Threads").click(); } /** @@ -539,7 +539,7 @@ class Helpers { const threadPanel = this.page.locator(".mx_ThreadPanel"); await expect(threadPanel).toBeVisible(); await threadPanel.evaluate(($panel) => { - const $button = $panel.querySelector('.mx_BaseCard_back[title="Threads"]'); + const $button = $panel.querySelector('.mx_BaseCard_back[aria-label="Threads"]'); // If the Threads back button is present then click it - the // threads button can open either threads list or thread panel if ($button) { diff --git a/playwright/e2e/spaces/threads-activity-centre/index.ts b/playwright/e2e/spaces/threads-activity-centre/index.ts index 7ad477541a..8bafe2e804 100644 --- a/playwright/e2e/spaces/threads-activity-centre/index.ts +++ b/playwright/e2e/spaces/threads-activity-centre/index.ts @@ -341,7 +341,7 @@ export class Helpers { */ assertThreadPanelFocused() { return expect( - this.page.locator(".mx_ThreadPanel").locator(".mx_BaseCard_header").getByTitle("Close"), + this.page.locator(".mx_ThreadPanel").locator(".mx_BaseCard_header").getByLabel("Close"), ).toBeFocused(); } diff --git a/src/accessibility/context_menu/ContextMenuButton.tsx b/src/accessibility/context_menu/ContextMenuButton.tsx index 6ef6afef37..8f6113dbd2 100644 --- a/src/accessibility/context_menu/ContextMenuButton.tsx +++ b/src/accessibility/context_menu/ContextMenuButton.tsx @@ -36,7 +36,6 @@ export const ContextMenuButton = forwardRef(function = DynamicHtmlElementProps & * Event handler for button activation. Should be implemented exactly like a normal `onClick` handler. */ onClick: ((e: ButtonEvent) => void | Promise) | null; + /** + * The tooltip to show on hover or focus. + */ + title?: string; + /** + * The caption is a secondary text displayed under the `title` of the tooltip. + * Only valid when used in conjunction with `title`. + */ + caption?: string; }; /** @@ -116,11 +126,14 @@ const AccessibleButton = forwardRef(function , ref: Ref, ): JSX.Element { const newProps: RenderedElementProps = restProps; + newProps["aria-label"] = newProps["aria-label"] ?? title; if (disabled) { newProps["aria-disabled"] = true; newProps["disabled"] = true; @@ -182,7 +195,16 @@ const AccessibleButton = forwardRef(function + {button} + + ); + } + return button; }); // Type assertion required due to forwardRef type workaround in react.d.ts diff --git a/src/components/views/elements/AccessibleTooltipButton.tsx b/src/components/views/elements/AccessibleTooltipButton.tsx index 0af5cc9625..4bb5d6efff 100644 --- a/src/components/views/elements/AccessibleTooltipButton.tsx +++ b/src/components/views/elements/AccessibleTooltipButton.tsx @@ -60,6 +60,9 @@ type Props = ComponentProps( { title, tooltip, children, forceHide, alignment, onHideTooltip, tooltipClassName, ...props }: Props, ref: Ref, diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index 2e7b9bc9ab..dbc6acb29b 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -237,7 +237,12 @@ export function DeviceItem({ ); } else { return ( - +
{deviceName}
{trustedLabel}
diff --git a/test/components/structures/__snapshots__/UserMenu-test.tsx.snap b/test/components/structures/__snapshots__/UserMenu-test.tsx.snap index a43b718020..029db9bfd4 100644 --- a/test/components/structures/__snapshots__/UserMenu-test.tsx.snap +++ b/test/components/structures/__snapshots__/UserMenu-test.tsx.snap @@ -12,7 +12,6 @@ exports[` when video broadcast when rendered should render class="mx_AccessibleButton mx_UserMenu_contextMenuButton" role="button" tabindex="0" - title="User menu" >
renders sidebar correctly with beacons 1`] = ` View list
renders sidebar correctly without beacons 1`] = ` View list
when user has live location monitor renders correctly when minimized 1`] = `
when user has live beacons and geolocation is Retry
ambiguous display name 1`] = `
ambiguous display name 1`] = ` exports[` with display name 1`] = `
with display name 1`] = ` exports[` without display name 1`] = `
with crypto enabled renders 1`] = ` class="mx_BaseCard_header" >
{ let prevMember: RoomMember | undefined; for (const tile of memberTiles) { const memberA = prevMember; - const memberB = memberListRoom.currentState.members[tile.getAttribute("title")!.split(" ")[0]]; + const memberB = memberListRoom.currentState.members[tile.getAttribute("aria-label")!.split(" ")[0]]; prevMember = memberB; // just in case an expect fails, set this early if (!memberA) { continue; diff --git a/test/components/views/rooms/__snapshots__/MemberTile-test.tsx.snap b/test/components/views/rooms/__snapshots__/MemberTile-test.tsx.snap index f40db566bb..77c87d93da 100644 --- a/test/components/views/rooms/__snapshots__/MemberTile-test.tsx.snap +++ b/test/components/views/rooms/__snapshots__/MemberTile-test.tsx.snap @@ -4,10 +4,11 @@ exports[`MemberTile should display an verified E2EIcon when the e2E status = Ver
handles when device is falsy 1`] = ` > Current session -
renders device and correct security card when