From e04490284d1d0be35f446c485c3273556ebed751 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 3 May 2021 21:50:25 -0600 Subject: [PATCH 01/23] Support UI for MSC2876: Widgets reading events from rooms MSC: https://github.com/matrix-org/matrix-doc/pull/2876 Fixes https://github.com/vector-im/element-web/issues/15747 Requires https://github.com/matrix-org/matrix-widget-api/pull/34 --- src/i18n/strings/en_EN.json | 13 +++++++ src/stores/widgets/StopGapWidgetDriver.ts | 45 +++++++++++++++++++++++ src/widgets/CapabilityText.tsx | 20 ++++++++++ 3 files changed, 78 insertions(+) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 5863f2a834..8a240264c0 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -598,20 +598,33 @@ "Change which room, message, or user you're viewing": "Change which room, message, or user you're viewing", "Change the topic of this room": "Change the topic of this room", "See when the topic changes in this room": "See when the topic changes in this room", + "See the current topic for this room": "See the current topic for this room", "Change the topic of your active room": "Change the topic of your active room", "See when the topic changes in your active room": "See when the topic changes in your active room", + "See the current topic in your active room": "See the current topic in your active room", "Change the name of this room": "Change the name of this room", "See when the name changes in this room": "See when the name changes in this room", + "See the current name for this room": "See the current name for this room", "Change the name of your active room": "Change the name of your active room", "See when the name changes in your active room": "See when the name changes in your active room", + "See the current name of your active room": "See the current name of your active room", "Change the avatar of this room": "Change the avatar of this room", "See when the avatar changes in this room": "See when the avatar changes in this room", + "See the current avatar for this room": "See the current avatar for this room", "Change the avatar of your active room": "Change the avatar of your active room", "See when the avatar changes in your active room": "See when the avatar changes in your active room", + "See the current avatar for your active room": "See the current avatar for your active room", + "Kick, ban, or invite people to this room, and make you leave": "Kick, ban, or invite people to this room, and make you leave", + "See when people join, leave, or are invited to this room": "See when people join, leave, or are invited to this room", + "See the membership status of anyone in this room": "See the membership status of anyone in this room", + "Kick, ban, or invite people to your active room, and make you leave": "Kick, ban, or invite people to your active room, and make you leave", + "See when people join, leave, or are invited to your active room": "See when people join, leave, or are invited to your active room", "Send stickers to this room as you": "Send stickers to this room as you", "See when a sticker is posted in this room": "See when a sticker is posted in this room", + "See recent stickers posted to this room": "See recent stickers posted to this room", "Send stickers to your active room as you": "Send stickers to your active room as you", "See when anyone posts a sticker to your active room": "See when anyone posts a sticker to your active room", + "See recent stickers posted to your active room": "See recent stickers posted to your active room", "with an empty state key": "with an empty state key", "with state key %(stateKey)s": "with state key %(stateKey)s", "Send %(eventType)s events as you in this room": "Send %(eventType)s events as you in this room", diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 8a286d909b..7d1c3f3791 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -44,6 +44,7 @@ import { CHAT_EFFECTS } from "../../effects"; import { containsEmoji } from "../../effects/utils"; import dis from "../../dispatcher/dispatcher"; import {tryTransformPermalinkToLocalHref} from "../../utils/permalinks/Permalinks"; +import {MatrixEvent} from "matrix-js-sdk/src/models/event"; // TODO: Purge this from the universe @@ -144,6 +145,50 @@ export class StopGapWidgetDriver extends WidgetDriver { return {roomId, eventId: r.event_id}; } + public async readRoomEvents(eventType: string, msgtype: string | undefined, limit: number): Promise { + limit = limit > 0 ? Math.min(limit, 25) : 25; // arbitrary choice + + const client = MatrixClientPeg.get(); + const roomId = ActiveRoomObserver.activeRoomId; + const room = client.getRoom(roomId); + if (!client || !roomId || !room) throw new Error("Not in a room or not attached to a client"); + + const results: MatrixEvent[] = []; + const events = room.getLiveTimeline().getEvents(); // timelines are most recent last + for (let i = events.length - 1; i > 0; i--) { + if (results.length >= limit) break; + + const ev = events[i]; + if (ev.getType() !== eventType) continue; + if (eventType === EventType.RoomMessage && msgtype && msgtype !== ev.getContent()['msgtype']) continue; + results.push(ev); + } + + return results.map(e => e.event); + } + + public async readStateEvents(eventType: string, stateKey: string | undefined, limit: number): Promise { + limit = limit > 0 ? Math.min(limit, 100) : 100; // arbitrary choice + + const client = MatrixClientPeg.get(); + const roomId = ActiveRoomObserver.activeRoomId; + const room = client.getRoom(roomId); + if (!client || !roomId || !room) throw new Error("Not in a room or not attached to a client"); + + const results: MatrixEvent[] = []; + const state = room.currentState.events.get(eventType); + if (state) { + if (stateKey === "" || !!stateKey) { + const forKey = state.get(stateKey); + if (forKey) results.push(forKey); + } else { + results.push(...Array.from(state.values())); + } + } + + return results.slice(0, limit).map(e => e.event); + } + public async askOpenID(observer: SimpleObservable) { const oidcState = WidgetPermissionStore.instance.getOIDCState( this.forWidget, this.forWidgetKind, this.inRoomId, diff --git a/src/widgets/CapabilityText.tsx b/src/widgets/CapabilityText.tsx index 273d22dc81..f7ff94947d 100644 --- a/src/widgets/CapabilityText.tsx +++ b/src/widgets/CapabilityText.tsx @@ -70,30 +70,48 @@ export class CapabilityText { [WidgetKind.Room]: { [EventDirection.Send]: _td("Change the topic of this room"), [EventDirection.Receive]: _td("See when the topic changes in this room"), + [EventDirection.Read]: _td("See the current topic for this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Change the topic of your active room"), [EventDirection.Receive]: _td("See when the topic changes in your active room"), + [EventDirection.Read]: _td("See the current topic in your active room"), }, }, [EventType.RoomName]: { [WidgetKind.Room]: { [EventDirection.Send]: _td("Change the name of this room"), [EventDirection.Receive]: _td("See when the name changes in this room"), + [EventDirection.Read]: _td("See the current name for this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Change the name of your active room"), [EventDirection.Receive]: _td("See when the name changes in your active room"), + [EventDirection.Read]: _td("See the current name of your active room"), }, }, [EventType.RoomAvatar]: { [WidgetKind.Room]: { [EventDirection.Send]: _td("Change the avatar of this room"), [EventDirection.Receive]: _td("See when the avatar changes in this room"), + [EventDirection.Read]: _td("See the current avatar for this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Change the avatar of your active room"), [EventDirection.Receive]: _td("See when the avatar changes in your active room"), + [EventDirection.Read]: _td("See the current avatar for your active room"), + }, + }, + [EventType.RoomMember]: { + [WidgetKind.Room]: { + [EventDirection.Send]: _td("Kick, ban, or invite people to this room, and make you leave"), + [EventDirection.Receive]: _td("See when people join, leave, or are invited to this room"), + [EventDirection.Read]: _td("See the membership status of anyone in this room"), + }, + [GENERIC_WIDGET_KIND]: { + [EventDirection.Send]: _td("Kick, ban, or invite people to your active room, and make you leave"), + [EventDirection.Receive]: _td("See when people join, leave, or are invited to your active room"), + [EventDirection.Read]: _td("See the membership status of anyone in this room"), }, }, }; @@ -103,10 +121,12 @@ export class CapabilityText { [WidgetKind.Room]: { [EventDirection.Send]: _td("Send stickers to this room as you"), [EventDirection.Receive]: _td("See when a sticker is posted in this room"), + [EventDirection.Read]: _td("See recent stickers posted to this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Send stickers to your active room as you"), [EventDirection.Receive]: _td("See when anyone posts a sticker to your active room"), + [EventDirection.Read]: _td("See recent stickers posted to your active room"), }, }, }; From 903cc77f3940190ffe64cddc6d9bc9b1271e3dd6 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 3 May 2021 21:53:23 -0600 Subject: [PATCH 02/23] Appease the linter --- src/stores/widgets/StopGapWidgetDriver.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 7d1c3f3791..25e81c47a2 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -167,7 +167,9 @@ export class StopGapWidgetDriver extends WidgetDriver { return results.map(e => e.event); } - public async readStateEvents(eventType: string, stateKey: string | undefined, limit: number): Promise { + public async readStateEvents( + eventType: string, stateKey: string | undefined, limit: number, + ): Promise { limit = limit > 0 ? Math.min(limit, 100) : 100; // arbitrary choice const client = MatrixClientPeg.get(); From 965b0ab58d0dceebff227ce895fff498cba9a1d7 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 11 May 2021 16:28:00 +0100 Subject: [PATCH 03/23] Upgrade matrix-js-sdk to 11.0.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 d9ea440936..4f6de8ce5c 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "katex": "^0.12.0", "linkifyjs": "^2.1.9", "lodash": "^4.17.20", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", + "matrix-js-sdk": "11.0.0-rc.1", "matrix-widget-api": "^0.1.0-beta.13", "minimist": "^1.2.5", "opus-recorder": "^8.0.3", diff --git a/yarn.lock b/yarn.lock index 7712ac507a..4fe12f3768 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5669,9 +5669,10 @@ mathml-tag-names@^2.1.3: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== -"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": - version "10.1.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/2d73805ca3d8c5a140fe05e574f826696de1656a" +matrix-js-sdk@11.0.0-rc.1: + version "11.0.0-rc.1" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-11.0.0-rc.1.tgz#a40fdc9e93a1a9e873dd867e5766a20ea780e1d8" + integrity sha512-zATTKWH4yrs6mKcLQNvhvwi1IRGUEx3xt3MPCFuSuQq23TMbnxhOZMMpUF6n19FpioHw9jbz7cPsdVKM2gpDLw== dependencies: "@babel/runtime" "^7.12.5" another-json "^0.2.0" From 657481156f33d456a0e53bf061adf2e36bcf4e4d Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 11 May 2021 16:36:52 +0100 Subject: [PATCH 04/23] Prepare changelog for v3.21.0-rc.1 --- CHANGELOG.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58d23e3413..fe714b2b89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,89 @@ +Changes in [3.21.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.21.0-rc.1) (2021-05-11) +=============================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.20.0...v3.21.0-rc.1) + + * Upgrade to JS SDK 11.0.0-rc.1 + * Add disclaimer about subspaces being experimental in add existing dialog + [\#5978](https://github.com/matrix-org/matrix-react-sdk/pull/5978) + * Spaces Beta release + [\#5933](https://github.com/matrix-org/matrix-react-sdk/pull/5933) + * Improve permissions error when adding new server to room directory + [\#6009](https://github.com/matrix-org/matrix-react-sdk/pull/6009) + * Allow user to progress through space creation & setup using Enter + [\#6006](https://github.com/matrix-org/matrix-react-sdk/pull/6006) + * Upgrade sanitize types + [\#6008](https://github.com/matrix-org/matrix-react-sdk/pull/6008) + * Upgrade `cheerio` and resolve type errors + [\#6007](https://github.com/matrix-org/matrix-react-sdk/pull/6007) + * Add slash commands support to edit message composer + [\#5865](https://github.com/matrix-org/matrix-react-sdk/pull/5865) + * Fix the two todays problem + [\#5940](https://github.com/matrix-org/matrix-react-sdk/pull/5940) + * Switch the Home Space out for an All rooms space + [\#5969](https://github.com/matrix-org/matrix-react-sdk/pull/5969) + * Show device ID in UserInfo when there is no device name + [\#5985](https://github.com/matrix-org/matrix-react-sdk/pull/5985) + * Switch back to release version of `sanitize-html` + [\#6005](https://github.com/matrix-org/matrix-react-sdk/pull/6005) + * Bump hosted-git-info from 2.8.8 to 2.8.9 + [\#5998](https://github.com/matrix-org/matrix-react-sdk/pull/5998) + * Don't use the event's metadata to calc the scale of an image + [\#5982](https://github.com/matrix-org/matrix-react-sdk/pull/5982) + * Adjust MIME type of upload confirmation if needed + [\#5981](https://github.com/matrix-org/matrix-react-sdk/pull/5981) + * Forbid redaction of encryption events + [\#5991](https://github.com/matrix-org/matrix-react-sdk/pull/5991) + * Fix voice message playback being squished up against send button + [\#5988](https://github.com/matrix-org/matrix-react-sdk/pull/5988) + * Improve style of notification badges on the space panel + [\#5983](https://github.com/matrix-org/matrix-react-sdk/pull/5983) + * Add dev dependency for parse5 typings + [\#5990](https://github.com/matrix-org/matrix-react-sdk/pull/5990) + * Iterate Spaces admin UX around room management + [\#5977](https://github.com/matrix-org/matrix-react-sdk/pull/5977) + * Guard all isSpaceRoom calls behind the labs flag + [\#5979](https://github.com/matrix-org/matrix-react-sdk/pull/5979) + * Bump lodash from 4.17.20 to 4.17.21 + [\#5986](https://github.com/matrix-org/matrix-react-sdk/pull/5986) + * Bump lodash from 4.17.19 to 4.17.21 in /test/end-to-end-tests + [\#5987](https://github.com/matrix-org/matrix-react-sdk/pull/5987) + * Bump ua-parser-js from 0.7.23 to 0.7.28 + [\#5984](https://github.com/matrix-org/matrix-react-sdk/pull/5984) + * Update visual style of plain files in the timeline + [\#5971](https://github.com/matrix-org/matrix-react-sdk/pull/5971) + * Support for multiple streams (not MSC3077) + [\#5833](https://github.com/matrix-org/matrix-react-sdk/pull/5833) + * Update space ordering behaviour to match updates in MSC + [\#5963](https://github.com/matrix-org/matrix-react-sdk/pull/5963) + * Improve performance of search all spaces and space switching + [\#5976](https://github.com/matrix-org/matrix-react-sdk/pull/5976) + * Update colours and sizing for voice messages + [\#5970](https://github.com/matrix-org/matrix-react-sdk/pull/5970) + * Update link to Android SDK + [\#5973](https://github.com/matrix-org/matrix-react-sdk/pull/5973) + * Add cleanup functions for image view + [\#5962](https://github.com/matrix-org/matrix-react-sdk/pull/5962) + * Add a note about sharing your IP in P2P calls + [\#5961](https://github.com/matrix-org/matrix-react-sdk/pull/5961) + * Only aggregate DM notifications on the Space Panel in the Home Space + [\#5968](https://github.com/matrix-org/matrix-react-sdk/pull/5968) + * Add retry mechanism and progress bar to add existing to space dialog + [\#5975](https://github.com/matrix-org/matrix-react-sdk/pull/5975) + * Warn on access token reveal + [\#5755](https://github.com/matrix-org/matrix-react-sdk/pull/5755) + * Fix newly joined room appearing under the wrong space + [\#5945](https://github.com/matrix-org/matrix-react-sdk/pull/5945) + * Early rendering for voice messages in the timeline + [\#5955](https://github.com/matrix-org/matrix-react-sdk/pull/5955) + * Calculate the real waveform in the Playback class for voice messages + [\#5956](https://github.com/matrix-org/matrix-react-sdk/pull/5956) + * Don't recurse on arrayFastResample + [\#5957](https://github.com/matrix-org/matrix-react-sdk/pull/5957) + * Support a dark theme for voice messages + [\#5958](https://github.com/matrix-org/matrix-react-sdk/pull/5958) + * Handle no/blocked microphones in voice messages + [\#5959](https://github.com/matrix-org/matrix-react-sdk/pull/5959) + Changes in [3.20.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.20.0) (2021-05-10) ===================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.20.0-rc.1...v3.20.0) From 392505e7a1447a1bf1c5fd7acbc5eed0528fce68 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 11 May 2021 16:36:53 +0100 Subject: [PATCH 05/23] v3.21.0-rc.1 --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4f6de8ce5c..a7fd78b903 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.20.0", + "version": "3.21.0-rc.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { @@ -25,7 +25,7 @@ "bin": { "reskindex": "scripts/reskindex.js" }, - "main": "./src/index.js", + "main": "./lib/index.js", "matrix_src_main": "./src/index.js", "matrix_lib_main": "./lib/index.js", "matrix_lib_typings": "./lib/index.d.ts", @@ -197,5 +197,6 @@ "coverageReporters": [ "text" ] - } + }, + "typings": "./lib/index.d.ts" } From 0717df71c22ae9ba2cddba4cefe1394fa95e9ab9 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 12 May 2021 12:32:39 +0100 Subject: [PATCH 06/23] Add missing space on beta feedback dialog --- src/components/views/dialogs/BetaFeedbackDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/dialogs/BetaFeedbackDialog.tsx b/src/components/views/dialogs/BetaFeedbackDialog.tsx index 119799c609..6619f11b33 100644 --- a/src/components/views/dialogs/BetaFeedbackDialog.tsx +++ b/src/components/views/dialogs/BetaFeedbackDialog.tsx @@ -63,7 +63,7 @@ const BetaFeedbackDialog: React.FC = ({featureId, onFinished}) => { description={
{ _t(info.feedbackSubheading) } - +   { _t("Your platform and username will be noted to help us use your feedback as much as we can.")} { From 5093657c717740152948fb2f7ef77e0b35e9452c Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 14 May 2021 14:17:10 -0600 Subject: [PATCH 07/23] Remove "read" level language for new API scope --- src/i18n/strings/en_EN.json | 9 --------- src/widgets/CapabilityText.tsx | 10 ---------- 2 files changed, 19 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 5126065031..9d5e17ba2d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -590,33 +590,24 @@ "Change which room, message, or user you're viewing": "Change which room, message, or user you're viewing", "Change the topic of this room": "Change the topic of this room", "See when the topic changes in this room": "See when the topic changes in this room", - "See the current topic for this room": "See the current topic for this room", "Change the topic of your active room": "Change the topic of your active room", "See when the topic changes in your active room": "See when the topic changes in your active room", - "See the current topic in your active room": "See the current topic in your active room", "Change the name of this room": "Change the name of this room", "See when the name changes in this room": "See when the name changes in this room", - "See the current name for this room": "See the current name for this room", "Change the name of your active room": "Change the name of your active room", "See when the name changes in your active room": "See when the name changes in your active room", - "See the current name of your active room": "See the current name of your active room", "Change the avatar of this room": "Change the avatar of this room", "See when the avatar changes in this room": "See when the avatar changes in this room", - "See the current avatar for this room": "See the current avatar for this room", "Change the avatar of your active room": "Change the avatar of your active room", "See when the avatar changes in your active room": "See when the avatar changes in your active room", - "See the current avatar for your active room": "See the current avatar for your active room", "Kick, ban, or invite people to this room, and make you leave": "Kick, ban, or invite people to this room, and make you leave", "See when people join, leave, or are invited to this room": "See when people join, leave, or are invited to this room", - "See the membership status of anyone in this room": "See the membership status of anyone in this room", "Kick, ban, or invite people to your active room, and make you leave": "Kick, ban, or invite people to your active room, and make you leave", "See when people join, leave, or are invited to your active room": "See when people join, leave, or are invited to your active room", "Send stickers to this room as you": "Send stickers to this room as you", "See when a sticker is posted in this room": "See when a sticker is posted in this room", - "See recent stickers posted to this room": "See recent stickers posted to this room", "Send stickers to your active room as you": "Send stickers to your active room as you", "See when anyone posts a sticker to your active room": "See when anyone posts a sticker to your active room", - "See recent stickers posted to your active room": "See recent stickers posted to your active room", "with an empty state key": "with an empty state key", "with state key %(stateKey)s": "with state key %(stateKey)s", "Send %(eventType)s events as you in this room": "Send %(eventType)s events as you in this room", diff --git a/src/widgets/CapabilityText.tsx b/src/widgets/CapabilityText.tsx index f7ff94947d..05e6c59083 100644 --- a/src/widgets/CapabilityText.tsx +++ b/src/widgets/CapabilityText.tsx @@ -70,48 +70,40 @@ export class CapabilityText { [WidgetKind.Room]: { [EventDirection.Send]: _td("Change the topic of this room"), [EventDirection.Receive]: _td("See when the topic changes in this room"), - [EventDirection.Read]: _td("See the current topic for this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Change the topic of your active room"), [EventDirection.Receive]: _td("See when the topic changes in your active room"), - [EventDirection.Read]: _td("See the current topic in your active room"), }, }, [EventType.RoomName]: { [WidgetKind.Room]: { [EventDirection.Send]: _td("Change the name of this room"), [EventDirection.Receive]: _td("See when the name changes in this room"), - [EventDirection.Read]: _td("See the current name for this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Change the name of your active room"), [EventDirection.Receive]: _td("See when the name changes in your active room"), - [EventDirection.Read]: _td("See the current name of your active room"), }, }, [EventType.RoomAvatar]: { [WidgetKind.Room]: { [EventDirection.Send]: _td("Change the avatar of this room"), [EventDirection.Receive]: _td("See when the avatar changes in this room"), - [EventDirection.Read]: _td("See the current avatar for this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Change the avatar of your active room"), [EventDirection.Receive]: _td("See when the avatar changes in your active room"), - [EventDirection.Read]: _td("See the current avatar for your active room"), }, }, [EventType.RoomMember]: { [WidgetKind.Room]: { [EventDirection.Send]: _td("Kick, ban, or invite people to this room, and make you leave"), [EventDirection.Receive]: _td("See when people join, leave, or are invited to this room"), - [EventDirection.Read]: _td("See the membership status of anyone in this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Kick, ban, or invite people to your active room, and make you leave"), [EventDirection.Receive]: _td("See when people join, leave, or are invited to your active room"), - [EventDirection.Read]: _td("See the membership status of anyone in this room"), }, }, }; @@ -121,12 +113,10 @@ export class CapabilityText { [WidgetKind.Room]: { [EventDirection.Send]: _td("Send stickers to this room as you"), [EventDirection.Receive]: _td("See when a sticker is posted in this room"), - [EventDirection.Read]: _td("See recent stickers posted to this room"), }, [GENERIC_WIDGET_KIND]: { [EventDirection.Send]: _td("Send stickers to your active room as you"), [EventDirection.Receive]: _td("See when anyone posts a sticker to your active room"), - [EventDirection.Read]: _td("See recent stickers posted to your active room"), }, }, }; From a48d786547cdaa4cab498bbe3ee9bf1d15468e67 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 14 May 2021 22:59:03 +0100 Subject: [PATCH 08/23] Update space order field validity requirements to match msc update --- src/stores/SpaceStore.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index b1b8199f93..ba2b91aa2c 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -62,7 +62,7 @@ export const getOrder = (order: string, creationTs: number, roomId: string): Arr if (typeof order === "string" && Array.from(order).every((c: string) => { const charCode = c.charCodeAt(0); - return charCode >= 0x20 && charCode <= 0x7F; + return charCode >= 0x20 && charCode <= 0x7E; })) { validatedOrder = order; } From fef081c736f80b9193bdf36f30e060dbe55142e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sat, 15 May 2021 15:07:15 +0200 Subject: [PATCH 09/23] Add id for homeserver field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/dialogs/ServerPickerDialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/dialogs/ServerPickerDialog.tsx b/src/components/views/dialogs/ServerPickerDialog.tsx index 62a2b95c68..1234d43582 100644 --- a/src/components/views/dialogs/ServerPickerDialog.tsx +++ b/src/components/views/dialogs/ServerPickerDialog.tsx @@ -217,6 +217,7 @@ export default class ServerPickerDialog extends React.PureComponent

From 37348375a2bfca59205546a942eaf18b43f9161f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sat, 15 May 2021 15:07:35 +0200 Subject: [PATCH 10/23] Add id for passpharase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- .../views/dialogs/security/AccessSecretStorageDialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx index ffe513581b..b9428289f4 100644 --- a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx +++ b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx @@ -345,6 +345,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent Date: Sat, 15 May 2021 16:13:02 +0200 Subject: [PATCH 11/23] Add mx to passPhraseInput --- .../views/dialogs/security/AccessSecretStorageDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx index b9428289f4..e09b39f4c7 100644 --- a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx +++ b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx @@ -345,7 +345,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent Date: Sat, 15 May 2021 16:13:26 +0200 Subject: [PATCH 12/23] Add mx to homeserverInput --- src/components/views/dialogs/ServerPickerDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/dialogs/ServerPickerDialog.tsx b/src/components/views/dialogs/ServerPickerDialog.tsx index 1234d43582..11fef9e75d 100644 --- a/src/components/views/dialogs/ServerPickerDialog.tsx +++ b/src/components/views/dialogs/ServerPickerDialog.tsx @@ -217,7 +217,7 @@ export default class ServerPickerDialog extends React.PureComponent

From f0a0d7f9981a29832a9645fc5d93e22a39cb2472 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 17 May 2021 10:01:24 +0100 Subject: [PATCH 13/23] Fix add reactions prompt button jumping timeline if font set lower than default --- res/css/views/messages/_ReactionsRow.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/res/css/views/messages/_ReactionsRow.scss b/res/css/views/messages/_ReactionsRow.scss index 244439bf74..e05065eb02 100644 --- a/res/css/views/messages/_ReactionsRow.scss +++ b/res/css/views/messages/_ReactionsRow.scss @@ -20,7 +20,8 @@ limitations under the License. .mx_ReactionsRow_addReactionButton { position: relative; - display: none; // show on hover of the .mx_EventTile + display: inline-block; + visibility: hidden; // show on hover of the .mx_EventTile width: 24px; height: 24px; vertical-align: middle; @@ -39,7 +40,7 @@ limitations under the License. } &.mx_ReactionsRow_addReactionButton_active { - display: inline-block; // keep showing whilst the context menu is shown + visibility: visible; // keep showing whilst the context menu is shown } &:hover, &.mx_ReactionsRow_addReactionButton_active { @@ -51,7 +52,7 @@ limitations under the License. } .mx_EventTile:hover .mx_ReactionsRow_addReactionButton { - display: inline-block; + visibility: visible; } .mx_ReactionsRow_showAll { From a22a1918e102f5506b5850f406b3d2d0d4ee3e92 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 17 May 2021 10:01:43 +0100 Subject: [PATCH 14/23] Fix add reactions prompt button showing up even if all reactions have been removed --- src/components/views/messages/ReactionsRow.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/views/messages/ReactionsRow.tsx b/src/components/views/messages/ReactionsRow.tsx index e1fcbe5364..627f7b35a5 100644 --- a/src/components/views/messages/ReactionsRow.tsx +++ b/src/components/views/messages/ReactionsRow.tsx @@ -174,6 +174,8 @@ export default class ReactionsRow extends React.PureComponent { />; }).filter(item => !!item); + if (!items.length) return null; + // Show the first MAX_ITEMS if there are MAX_ITEMS + 1 or more items. // The "+ 1" ensure that the "show all" reveals something that takes up // more space than the button itself. From 6e5847ea6b253715c6c3e5a17db67ca46c4dec6b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 17 May 2021 10:01:56 +0100 Subject: [PATCH 15/23] Fix right clicking on add reactions prompt button behaviour --- src/components/views/messages/ReactionsRow.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/views/messages/ReactionsRow.tsx b/src/components/views/messages/ReactionsRow.tsx index 627f7b35a5..8809302088 100644 --- a/src/components/views/messages/ReactionsRow.tsx +++ b/src/components/views/messages/ReactionsRow.tsx @@ -50,6 +50,10 @@ const ReactButton = ({ mxEvent, reactions }: IProps) => { })} title={_t("Add reaction")} onClick={openMenu} + onContextMenu={e => { + e.preventDefault(); + openMenu(); + }} isExpanded={menuDisplayed} inputRef={button} /> From 6c066ee40148098dc254e39b2920b00b330df0c2 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 17 May 2021 13:33:45 +0100 Subject: [PATCH 16/23] Upgrade matrix-js-sdk to 11.0.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a7fd78b903..160867776f 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "katex": "^0.12.0", "linkifyjs": "^2.1.9", "lodash": "^4.17.20", - "matrix-js-sdk": "11.0.0-rc.1", + "matrix-js-sdk": "11.0.0", "matrix-widget-api": "^0.1.0-beta.13", "minimist": "^1.2.5", "opus-recorder": "^8.0.3", diff --git a/yarn.lock b/yarn.lock index 4fe12f3768..be735eea39 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5669,10 +5669,10 @@ mathml-tag-names@^2.1.3: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== -matrix-js-sdk@11.0.0-rc.1: - version "11.0.0-rc.1" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-11.0.0-rc.1.tgz#a40fdc9e93a1a9e873dd867e5766a20ea780e1d8" - integrity sha512-zATTKWH4yrs6mKcLQNvhvwi1IRGUEx3xt3MPCFuSuQq23TMbnxhOZMMpUF6n19FpioHw9jbz7cPsdVKM2gpDLw== +matrix-js-sdk@11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-11.0.0.tgz#66428b3d7606acd0d566ebc7cc7333e15f25b2a8" + integrity sha512-54yhqGRlogNv1QKpnn5kDAJ6z5MwoXH/Yqv0cFpq0lS1mzVJUIg4urpNPQBDidcA0IqGhu4aYUuy5s1cwHyTsg== dependencies: "@babel/runtime" "^7.12.5" another-json "^0.2.0" From 6b884a50dc6ad0aef07976fc15af85940f9e4e7d Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 17 May 2021 13:48:59 +0100 Subject: [PATCH 17/23] Prepare changelog for v3.21.0 --- CHANGELOG.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe714b2b89..2582668ef9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +Changes in [3.21.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.21.0) (2021-05-17) +===================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.21.0-rc.1...v3.21.0) + +## Security notice + +matrix-react-sdk 3.21.0 fixes a low severity issue (GHSA-8796-gc9j-63rv) +related to file upload. When uploading a file, the local file preview can lead +to execution of scripts embedded in the uploaded file, but only after several +user interactions to open the preview in a separate tab. This only impacts the +local user while in the process of uploading. It cannot be exploited remotely +or by other users. Thanks to [Muhammad Zaid Ghifari](https://github.com/MR-ZHEEV) +for responsibly disclosing this via Matrix's Security Disclosure Policy. + +## All changes + + * Upgrade to JS SDK 11.0.0 + * [Release] Add missing space on beta feedback dialog + [\#6019](https://github.com/matrix-org/matrix-react-sdk/pull/6019) + * [Release] Add feedback mechanism for beta features, namely Spaces + [\#6013](https://github.com/matrix-org/matrix-react-sdk/pull/6013) + * Add feedback mechanism for beta features, namely Spaces + [\#6012](https://github.com/matrix-org/matrix-react-sdk/pull/6012) + Changes in [3.21.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.21.0-rc.1) (2021-05-11) =============================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.20.0...v3.21.0-rc.1) From 3673292c3495a40df781edd3e7f4c510b39875dc Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 17 May 2021 13:49:00 +0100 Subject: [PATCH 18/23] v3.21.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 160867776f..241bc45512 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.21.0-rc.1", + "version": "3.21.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 9d46fa7b994da54f8e48a70f6c0f46074ec6f319 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 17 May 2021 13:50:24 +0100 Subject: [PATCH 19/23] Resetting package fields for development --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 176a0a0f3f..4e6b3e074a 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "bin": { "reskindex": "scripts/reskindex.js" }, - "main": "./lib/index.js", + "main": "./src/index.js", "matrix_src_main": "./src/index.js", "matrix_lib_main": "./lib/index.js", "matrix_lib_typings": "./lib/index.d.ts", @@ -200,6 +200,5 @@ "coverageReporters": [ "text" ] - }, - "typings": "./lib/index.d.ts" + } } From 12a9ce1a94440e6b96f739fb5e4f148a8f100535 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 17 May 2021 13:50:34 +0100 Subject: [PATCH 20/23] Reset matrix-js-sdk back to develop branch --- package.json | 2 +- yarn.lock | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4e6b3e074a..1bd381d26c 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "katex": "^0.12.0", "linkifyjs": "^2.1.9", "lodash": "^4.17.20", - "matrix-js-sdk": "11.0.0", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "matrix-widget-api": "^0.1.0-beta.13", "minimist": "^1.2.5", "opus-recorder": "^8.0.3", diff --git a/yarn.lock b/yarn.lock index be735eea39..1a3b746727 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5669,10 +5669,9 @@ mathml-tag-names@^2.1.3: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== -matrix-js-sdk@11.0.0: +"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "11.0.0" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-11.0.0.tgz#66428b3d7606acd0d566ebc7cc7333e15f25b2a8" - integrity sha512-54yhqGRlogNv1QKpnn5kDAJ6z5MwoXH/Yqv0cFpq0lS1mzVJUIg4urpNPQBDidcA0IqGhu4aYUuy5s1cwHyTsg== + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/52a893a8116d60bb76f1b015d3161a15404b3628" dependencies: "@babel/runtime" "^7.12.5" another-json "^0.2.0" From c67f31144f279d6e87169376b1646c8ca53ff38e Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Mon, 17 May 2021 14:45:41 +0100 Subject: [PATCH 21/23] remove custom LoggedInView::shouldComponentUpdate logic --- src/components/structures/LoggedInView.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index c4b9696807..eb5d49f56d 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -219,16 +219,6 @@ class LoggedInView extends React.Component { }); }; - // Child components assume that the client peg will not be null, so give them some - // sort of assurance here by only allowing a re-render if the client is truthy. - // - // This is required because `LoggedInView` maintains its own state and if this state - // updates after the client peg has been made null (during logout), then it will - // attempt to re-render and the children will throw errors. - shouldComponentUpdate() { - return Boolean(MatrixClientPeg.get()); - } - canResetTimelineInRoom = (roomId) => { if (!this._roomView.current) { return true; From 7e846b8532453e7e74499a9790fff55fe91f51d8 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Mon, 17 May 2021 15:05:20 +0100 Subject: [PATCH 22/23] remove unused import --- src/components/structures/LoggedInView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index eb5d49f56d..ad5c759f0d 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -27,7 +27,7 @@ import CallMediaHandler from '../../CallMediaHandler'; import { fixupColorFonts } from '../../utils/FontManager'; import * as sdk from '../../index'; import dis from '../../dispatcher/dispatcher'; -import {MatrixClientPeg, IMatrixClientCreds} from '../../MatrixClientPeg'; +import { IMatrixClientCreds } from '../../MatrixClientPeg'; import SettingsStore from "../../settings/SettingsStore"; import TagOrderActions from '../../actions/TagOrderActions'; From d3f1754dfd9fceff5df45b4f8cdaf9e606214dbc Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Mon, 17 May 2021 12:24:41 -0400 Subject: [PATCH 23/23] Fix crash on opening notification panel The check for pending edits needed a null guard, since the notification panel uses MessagePanel but is not associated with a specific room. Signed-off-by: Robin Townsend --- src/components/structures/MessagePanel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index 73a2a3c4b6..d1071a9e19 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -473,7 +473,7 @@ export default class MessagePanel extends React.Component { } get _roomHasPendingEdit() { - return localStorage.getItem(`mx_edit_room_${this.props.room.roomId}`); + return this.props.room && localStorage.getItem(`mx_edit_room_${this.props.room.roomId}`); } _getEventTiles() {