From a806c165c9507cfab0caa6c7fc2096d1cd8b67fd Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 2 May 2023 11:37:01 +0100 Subject: [PATCH 1/9] Upgrade matrix-js-sdk to 25.1.0-rc.1 --- package.json | 2 +- yarn.lock | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7e110a52de..8ed2e8964b 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,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": "25.1.0-rc.1", "matrix-widget-api": "^1.3.1", "memoize-one": "^5.1.1", "minimist": "^1.2.5", diff --git a/yarn.lock b/yarn.lock index 7991d2117b..cf88011dc8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6471,9 +6471,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 "25.0.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/e3498f0668e30cd545cf0614e6e6e9203a9e359d" +matrix-js-sdk@25.1.0-rc.1: + version "25.1.0-rc.1" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-25.1.0-rc.1.tgz#886d43fad66e14bf0d62e812f042def68e7c830f" + integrity sha512-Eo+CdaSlD5/AbY6WgG+tIgRODm7kPbutlAcOV4plEsELBo9rMSoR+3gZkTptoo7dgL+O+B6AqAPdLEhFgg3wvw== dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-js" "^0.1.0-alpha.7" From c8cfa0cd6a492d08bd007642b346d516037d3675 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 2 May 2023 11:38:59 +0100 Subject: [PATCH 2/9] Prepare changelog for v3.72.0-rc.1 --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 287e17ddc0..95b7e3d07b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +Changes in [3.72.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.72.0-rc.1) (2023-05-02) +=============================================================================================================== + +## ✨ Features + * Add UIFeature.locationSharing to hide location sharing ([\#10727](https://github.com/matrix-org/matrix-react-sdk/pull/10727)). + * Memoize field validation results ([\#10714](https://github.com/matrix-org/matrix-react-sdk/pull/10714)). + * Commands for plain text editor ([\#10567](https://github.com/matrix-org/matrix-react-sdk/pull/10567)). Contributed by @alunturner. + * Allow 16 lines of text in the rich text editors ([\#10670](https://github.com/matrix-org/matrix-react-sdk/pull/10670)). Contributed by @alunturner. + * Bail out of `RoomSettingsDialog` when room is not found ([\#10662](https://github.com/matrix-org/matrix-react-sdk/pull/10662)). Contributed by @kerryarchibald. + * Element-R: Populate device list for right-panel ([\#10671](https://github.com/matrix-org/matrix-react-sdk/pull/10671)). Contributed by @florianduros. + * Make existing and new issue URLs configurable ([\#10710](https://github.com/matrix-org/matrix-react-sdk/pull/10710)). Fixes vector-im/element-web#24424. + * Fix usages of ARIA tabpanel ([\#10628](https://github.com/matrix-org/matrix-react-sdk/pull/10628)). Fixes vector-im/element-web#25016. + * Element-R: Starting a DMs with a user ([\#10673](https://github.com/matrix-org/matrix-react-sdk/pull/10673)). Contributed by @florianduros. + * ARIA Accessibility improvements ([\#10675](https://github.com/matrix-org/matrix-react-sdk/pull/10675)). + * ARIA Accessibility improvements ([\#10674](https://github.com/matrix-org/matrix-react-sdk/pull/10674)). + * Add arrow key controls to emoji and reaction pickers ([\#10637](https://github.com/matrix-org/matrix-react-sdk/pull/10637)). Fixes vector-im/element-web#17189. + * Translate credits in help about section ([\#10676](https://github.com/matrix-org/matrix-react-sdk/pull/10676)). + +## 🐛 Bug Fixes + * Fix autocomplete not resetting properly on message send ([\#10741](https://github.com/matrix-org/matrix-react-sdk/pull/10741)). Fixes vector-im/element-web#25170. + * Fix start_sso not working with guests disabled ([\#10720](https://github.com/matrix-org/matrix-react-sdk/pull/10720)). Fixes vector-im/element-web#16624. + * Fix soft crash with Element call widgets ([\#10684](https://github.com/matrix-org/matrix-react-sdk/pull/10684)). + * Send correct receipt when marking a room as read ([\#10730](https://github.com/matrix-org/matrix-react-sdk/pull/10730)). Fixes vector-im/element-web#25207. + * Offload some more waveform processing onto a worker ([\#9223](https://github.com/matrix-org/matrix-react-sdk/pull/9223)). Fixes vector-im/element-web#19756. + * Consolidate login errors ([\#10722](https://github.com/matrix-org/matrix-react-sdk/pull/10722)). Fixes vector-im/element-web#17520. + * Fix all rooms search generating permalinks to wrong room id ([\#10625](https://github.com/matrix-org/matrix-react-sdk/pull/10625)). Fixes vector-im/element-web#25115. + * Posthog properly handle Analytics ID changing from under us ([\#10702](https://github.com/matrix-org/matrix-react-sdk/pull/10702)). Fixes vector-im/element-web#25187. + * Fix Clock being read as an absolute time rather than duration ([\#10706](https://github.com/matrix-org/matrix-react-sdk/pull/10706)). Fixes vector-im/element-web#22582. + * Properly translate errors in `ChangePassword.tsx` so they show up translated to the user but not in our logs ([\#10615](https://github.com/matrix-org/matrix-react-sdk/pull/10615)). Fixes vector-im/element-web#9597. Contributed by @MadLittleMods. + * Honour feature toggles in guest mode ([\#10651](https://github.com/matrix-org/matrix-react-sdk/pull/10651)). Fixes vector-im/element-web#24513. Contributed by @andybalaam. + * Fix default content in devtools event sender ([\#10699](https://github.com/matrix-org/matrix-react-sdk/pull/10699)). Contributed by @tulir. + * Fix a crash when a call ends while you're in it ([\#10681](https://github.com/matrix-org/matrix-react-sdk/pull/10681)). Fixes vector-im/element-web#25153. + * Fix lack of screen reader indication when triggering auto complete ([\#10664](https://github.com/matrix-org/matrix-react-sdk/pull/10664)). Fixes vector-im/element-web#11011. + * Fix typing tile duplicating users ([\#10678](https://github.com/matrix-org/matrix-react-sdk/pull/10678)). Fixes vector-im/element-web#25165. + * Fix wrong room topic tooltip position ([\#10667](https://github.com/matrix-org/matrix-react-sdk/pull/10667)). Fixes vector-im/element-web#25158. + * Fix create subspace dialog not working ([\#10652](https://github.com/matrix-org/matrix-react-sdk/pull/10652)). Fixes vector-im/element-web#24882. + Changes in [3.71.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.71.1) (2023-04-25) ===================================================================================================== From 23365ed023008f42b97fb39e28e5fad4880fd43e Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 2 May 2023 11:39:04 +0100 Subject: [PATCH 3/9] v3.72.0-rc.1 --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8ed2e8964b..80bde1c6d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.71.1", + "version": "3.72.0-rc.1", "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", @@ -222,5 +222,6 @@ "outputDirectory": "coverage", "outputName": "jest-sonar-report.xml", "relativePaths": true - } + }, + "typings": "./lib/index.d.ts" } From b19a13dc8b3e84a550aa6e7d21de9d399241b0f3 Mon Sep 17 00:00:00 2001 From: ElementRobot Date: Fri, 5 May 2023 13:13:51 +0100 Subject: [PATCH 4/9] Fix: reveal images when image previews are disabled (#10781) (#10799) * fix image wrapping when showImage previews is disabled * strict v2 (cherry picked from commit 542bf68c6368066d9becbde3fd2ded9d6cac4d56) Co-authored-by: Kerry --- src/components/views/messages/MImageBody.tsx | 25 ++++++--- .../views/messages/MImageBody-test.tsx | 54 ++++++++++++++++++- 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/src/components/views/messages/MImageBody.tsx b/src/components/views/messages/MImageBody.tsx index 84e4e763de..27ccdd4228 100644 --- a/src/components/views/messages/MImageBody.tsx +++ b/src/components/views/messages/MImageBody.tsx @@ -389,7 +389,7 @@ export default class MImageBody extends React.Component { thumbUrl: string | null, content: IMediaEventContent, forcedHeight?: number, - ): JSX.Element { + ): ReactNode { if (!thumbUrl) thumbUrl = contentUrl; // fallback // magic number @@ -524,16 +524,25 @@ export default class MImageBody extends React.Component { ); - return contentUrl ? this.wrapImage(contentUrl, thumbnail) : thumbnail; + return this.wrapImage(contentUrl, thumbnail); } // Overridden by MStickerBody - protected wrapImage(contentUrl: string, children: JSX.Element): JSX.Element { - return ( - - {children} - - ); + protected wrapImage(contentUrl: string | null | undefined, children: JSX.Element): ReactNode { + if (contentUrl) { + return ( + + {children} + + ); + } else if (!this.state.showImage) { + return ( +
+ {children} +
+ ); + } + return children; } // Overridden by MStickerBody diff --git a/test/components/views/messages/MImageBody-test.tsx b/test/components/views/messages/MImageBody-test.tsx index 6534828bd6..ca400f13ee 100644 --- a/test/components/views/messages/MImageBody-test.tsx +++ b/test/components/views/messages/MImageBody-test.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React from "react"; -import { render, screen } from "@testing-library/react"; +import { fireEvent, render, screen } from "@testing-library/react"; import { EventType, MatrixEvent, Room } from "matrix-js-sdk/src/matrix"; import fetchMock from "fetch-mock-jest"; import encrypt from "matrix-encrypt-attachment"; @@ -31,6 +31,7 @@ import { mockClientMethodsUser, } from "../../../test-utils"; import { MediaEventHelper } from "../../../../src/utils/MediaEventHelper"; +import SettingsStore from "../../../../src/settings/SettingsStore"; jest.mock("matrix-encrypt-attachment", () => ({ decryptAttachment: jest.fn(), @@ -61,6 +62,7 @@ describe("", () => { sender: userId, type: EventType.RoomMessage, content: { + body: "alt for a test image", info: { w: 40, h: 50, @@ -70,12 +72,18 @@ describe("", () => { }, }, }); + const props = { onHeightChanged: jest.fn(), onMessageAllowed: jest.fn(), permalinkCreator: new RoomPermalinkCreator(new Room(encryptedMediaEvent.getRoomId()!, cli, cli.getUserId()!)), }; + beforeEach(() => { + jest.spyOn(SettingsStore, "getValue").mockRestore(); + fetchMock.mockReset(); + }); + it("should show a thumbnail while image is being downloaded", async () => { fetchMock.getOnce(url, { status: 200 }); @@ -102,6 +110,8 @@ describe("", () => { />, ); + expect(fetchMock).toHaveBeenCalledWith(url); + await screen.findByText("Error downloading image"); }); @@ -119,4 +129,46 @@ describe("", () => { await screen.findByText("Error decrypting image"); }); + + describe("with image previews/thumbnails disabled", () => { + beforeEach(() => { + jest.spyOn(SettingsStore, "getValue").mockReturnValue(false); + }); + + it("should not download image", async () => { + fetchMock.getOnce(url, { status: 200 }); + + render( + , + ); + + expect(fetchMock).not.toHaveFetched(url); + }); + + it("should render hidden image placeholder", async () => { + fetchMock.getOnce(url, { status: 200 }); + + render( + , + ); + + expect(screen.getByText("Show image")).toBeInTheDocument(); + + fireEvent.click(screen.getByRole("button")); + + // image fetched after clicking show image + expect(fetchMock).toHaveFetched(url); + + // spinner while downloading image + expect(screen.getByRole("progressbar")).toBeInTheDocument(); + }); + }); }); From 66fa949c2c74772e58bce82a97973fb3aa00b28e Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 5 May 2023 15:17:12 +0100 Subject: [PATCH 5/9] Prepare changelog for v3.72.0-rc.2 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95b7e3d07b..79a140cfb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [3.72.0-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.72.0-rc.2) (2023-05-05) +=============================================================================================================== + +## 🐛 Bug Fixes + * Fix: reveal images when image previews are disabled ([\#10781](https://github.com/matrix-org/matrix-react-sdk/pull/10781)). Fixes vector-im/element-web#25271. Contributed by @kerryarchibald. + Changes in [3.72.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.72.0-rc.1) (2023-05-02) =============================================================================================================== From 3de332b2cc4c213a452c8b1f7a940606f7dcc809 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 5 May 2023 15:17:14 +0100 Subject: [PATCH 6/9] v3.72.0-rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 80bde1c6d5..3625309bc2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.72.0-rc.1", + "version": "3.72.0-rc.2", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 5a2043b472f812fdf79a11d9029e15335f1372d2 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 10 May 2023 12:14:51 +0100 Subject: [PATCH 7/9] Upgrade matrix-js-sdk to 25.1.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3625309bc2..cd6deff402 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "maplibre-gl": "^2.0.0", "matrix-encrypt-attachment": "^1.0.3", "matrix-events-sdk": "0.0.1", - "matrix-js-sdk": "25.1.0-rc.1", + "matrix-js-sdk": "25.1.0", "matrix-widget-api": "^1.3.1", "memoize-one": "^5.1.1", "minimist": "^1.2.5", diff --git a/yarn.lock b/yarn.lock index cf88011dc8..be1554d5fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6471,10 +6471,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@25.1.0-rc.1: - version "25.1.0-rc.1" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-25.1.0-rc.1.tgz#886d43fad66e14bf0d62e812f042def68e7c830f" - integrity sha512-Eo+CdaSlD5/AbY6WgG+tIgRODm7kPbutlAcOV4plEsELBo9rMSoR+3gZkTptoo7dgL+O+B6AqAPdLEhFgg3wvw== +matrix-js-sdk@25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-25.1.0.tgz#86bfd96e70fab83dc131254dd9e9aaeb5cfafbc9" + integrity sha512-zVAg73FiFrFacS/q9hLnRaSPvg84VT/X70VIOigp2eOMUhot35UnNL99YUbfkksY95/UnvgrqJkyaZcm8lSspQ== dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-js" "^0.1.0-alpha.7" From 5e7b49c212fe2fffef9d58abcb7aae58a0b504a2 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 10 May 2023 12:20:21 +0100 Subject: [PATCH 8/9] Prepare changelog for v3.72.0 --- CHANGELOG.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79a140cfb2..40cf7259ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,5 @@ -Changes in [3.72.0-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.72.0-rc.2) (2023-05-05) -=============================================================================================================== - -## 🐛 Bug Fixes - * Fix: reveal images when image previews are disabled ([\#10781](https://github.com/matrix-org/matrix-react-sdk/pull/10781)). Fixes vector-im/element-web#25271. Contributed by @kerryarchibald. - -Changes in [3.72.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.72.0-rc.1) (2023-05-02) -=============================================================================================================== +Changes in [3.72.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.72.0) (2023-05-10) +===================================================================================================== ## ✨ Features * Add UIFeature.locationSharing to hide location sharing ([\#10727](https://github.com/matrix-org/matrix-react-sdk/pull/10727)). @@ -23,6 +17,7 @@ Changes in [3.72.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases * Translate credits in help about section ([\#10676](https://github.com/matrix-org/matrix-react-sdk/pull/10676)). ## 🐛 Bug Fixes + * Fix: reveal images when image previews are disabled ([\#10781](https://github.com/matrix-org/matrix-react-sdk/pull/10781)). Fixes vector-im/element-web#25271. Contributed by @kerryarchibald. * Fix autocomplete not resetting properly on message send ([\#10741](https://github.com/matrix-org/matrix-react-sdk/pull/10741)). Fixes vector-im/element-web#25170. * Fix start_sso not working with guests disabled ([\#10720](https://github.com/matrix-org/matrix-react-sdk/pull/10720)). Fixes vector-im/element-web#16624. * Fix soft crash with Element call widgets ([\#10684](https://github.com/matrix-org/matrix-react-sdk/pull/10684)). From 0e2f0009cecbf8c729189c77b427ed71be0ea969 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 10 May 2023 12:20:23 +0100 Subject: [PATCH 9/9] v3.72.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd6deff402..ba1a075778 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.72.0-rc.2", + "version": "3.72.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {