From a2280aae64838e70873b6f4172874ad1a8ef4002 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 21 Oct 2020 16:05:20 +0100 Subject: [PATCH 1/7] Fix stickerpicker not having correct contexts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/PersistedElement.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/PersistedElement.js b/src/components/views/elements/PersistedElement.js index fc0b9edddd..488af5c6a9 100644 --- a/src/components/views/elements/PersistedElement.js +++ b/src/components/views/elements/PersistedElement.js @@ -21,6 +21,8 @@ import {throttle} from "lodash"; import ResizeObserver from 'resize-observer-polyfill'; import dis from '../../../dispatcher/dispatcher'; +import MatrixClientContext from "../../../contexts/MatrixClientContext"; +import {MatrixClientPeg} from "../../../MatrixClientPeg"; // Shamelessly ripped off Modal.js. There's probably a better way // of doing reusable widgets like dialog boxes & menus where we go and @@ -144,9 +146,11 @@ export default class PersistedElement extends React.Component { } renderApp() { - const content =
- {this.props.children} -
; + const content = +
+ {this.props.children} +
+
; ReactDOM.render(content, getOrCreateContainer('mx_persistedElement_'+this.props.persistKey)); } From 951ad5d58174adf23eff00c3da21eeed55e0d5dd Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 21 Oct 2020 16:05:44 +0100 Subject: [PATCH 2/7] Remove redundant event listener Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/right_panel/RoomSummaryCard.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/views/right_panel/RoomSummaryCard.tsx b/src/components/views/right_panel/RoomSummaryCard.tsx index 77e76d1c25..621e85e1d4 100644 --- a/src/components/views/right_panel/RoomSummaryCard.tsx +++ b/src/components/views/right_panel/RoomSummaryCard.tsx @@ -31,7 +31,6 @@ import {SetRightPanelPhasePayload} from "../../../dispatcher/payloads/SetRightPa import Modal from "../../../Modal"; import ShareDialog from '../dialogs/ShareDialog'; import {useEventEmitter} from "../../../hooks/useEventEmitter"; -import WidgetEchoStore from "../../../stores/WidgetEchoStore"; import WidgetUtils from "../../../utils/WidgetUtils"; import {IntegrationManagers} from "../../../integrations/IntegrationManagers"; import SettingsStore from "../../../settings/SettingsStore"; @@ -77,7 +76,6 @@ export const useWidgets = (room: Room) => { }, [room]); useEffect(updateApps, [room]); - useEventEmitter(WidgetEchoStore, "update", updateApps); useEventEmitter(WidgetStore.instance, room.roomId, updateApps); return apps; From cf23417e6e43e65f9ed0b60f685c219dd59b5c32 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 21 Oct 2020 16:06:22 +0100 Subject: [PATCH 3/7] Fix WidgetStore wrongly hanging onto old Widget definitions during removal Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/stores/WidgetEchoStore.js | 2 +- src/stores/WidgetStore.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/stores/WidgetEchoStore.js b/src/stores/WidgetEchoStore.js index 7dd093d45e..3aef1beb3e 100644 --- a/src/stores/WidgetEchoStore.js +++ b/src/stores/WidgetEchoStore.js @@ -55,7 +55,7 @@ class WidgetEchoStore extends EventEmitter { const widgetId = w.getStateKey(); // If there's no echo, or the echo still has a widget present, show the *old* widget // we don't include widgets that have changed for the same reason we don't include new ones, - // ie. we'd need to fake matrix events to do so and therte's currently no need. + // ie. we'd need to fake matrix events to do so and there's currently no need. if (!roomEchoState[widgetId] || Object.keys(roomEchoState[widgetId]).length !== 0) { echoedWidgets.push(w); } diff --git a/src/stores/WidgetStore.ts b/src/stores/WidgetStore.ts index 1caea659ca..a8040f57de 100644 --- a/src/stores/WidgetStore.ts +++ b/src/stores/WidgetStore.ts @@ -122,6 +122,15 @@ export default class WidgetStore extends AsyncStoreWithClient { if (!room) return; const roomInfo = this.roomMap.get(room.roomId); roomInfo.widgets = []; + + // first clean out old widgets from the map which originate from this room + // otherwise we are out of sync with the rest of the app with stale widget events during removal + Array.from(this.widgetMap.values()).forEach(app => { + if (app.roomId === room.roomId) { + this.widgetMap.delete(app.id); + } + }); + this.generateApps(room).forEach(app => { this.widgetMap.set(app.id, app); roomInfo.widgets.push(app); From 2fb05257564a121d67bf66c537bdee1f544c3b7b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 27 Oct 2020 11:13:55 +0000 Subject: [PATCH 4/7] Fix theme variable passed to Jitsi --- src/stores/widgets/StopGapWidget.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index edce39d033..4cc8a99d74 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -49,6 +49,8 @@ import defaultDispatcher from "../../dispatcher/dispatcher"; import { ElementWidgetActions } from "./ElementWidgetActions"; import Modal from "../../Modal"; import WidgetOpenIDPermissionsDialog from "../../components/views/dialogs/WidgetOpenIDPermissionsDialog"; +import ThemeWatcher from "../../settings/watchers/ThemeWatcher"; +import {getCustomTheme} from "../../theme"; // TODO: Destroy all of this code @@ -102,9 +104,25 @@ class ElementWidget extends Widget { // v1 widgets default to jitsi.riot.im regardless of user settings domain = "jitsi.riot.im"; } + + let theme = new ThemeWatcher().getEffectiveTheme(); + if (theme.startsWith("custom-")) { + const customTheme = getCustomTheme(theme.substr(7)); + // Jitsi only understands light/dark + theme = customTheme.is_dark ? "dark" : "light"; + } + + // only allow light/dark through, defaulting to dark as that was previously the only state + // accounts for legacy-light/legacy-dark themes too + if (theme.includes("light")) { + theme = "light"; + } else { + theme = "dark"; + } + return { ...super.rawData, - theme: SettingsStore.getValue("theme"), + theme, conferenceId, domain, }; From de6589705caefb36638de206eebc57edc487b5d7 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 28 Oct 2020 14:17:48 +0000 Subject: [PATCH 5/7] Upgrade matrix-js-sdk to 9.0.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 45ae3ffffe..c19c048696 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "is-ip": "^2.0.0", "linkifyjs": "^2.1.9", "lodash": "^4.17.19", - "matrix-js-sdk": "9.0.0", + "matrix-js-sdk": "9.0.1", "matrix-widget-api": "^0.1.0-beta.5", "minimist": "^1.2.5", "pako": "^1.0.11", diff --git a/yarn.lock b/yarn.lock index 9f9ef1e5de..f06222d3f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6505,10 +6505,10 @@ mathml-tag-names@^2.0.1: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== -matrix-js-sdk@9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.0.0.tgz#97d995fcb4209161a761cf59238caf52ff34882b" - integrity sha512-GEQ51wxnBfY00m39aMWVa2/sZqUFBsRWrsImr+mkXtPYs1OQVXHVipL2B3/rObOO+A+3bo7tfoaTTxhpQl2CaQ== +matrix-js-sdk@9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.0.1.tgz#bb84a80db0dec1c21b6867c38bb2aa3f63811d6d" + integrity sha512-D2b/pf1/0FTnJoroZhhFCo9WFv+iXELqDgEozo0mBSTbQolIXjHLDQfmhi3p7nDZxxtjWvJjVaiKiVQPjwHCrg== dependencies: "@babel/runtime" "^7.11.2" another-json "^0.2.0" From 6c7284afba82c4745c819e3f96ae4298b89e185c Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 28 Oct 2020 14:25:34 +0000 Subject: [PATCH 6/7] Prepare changelog for v3.7.1 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0a0b2147f..5f5372ae5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +Changes in [3.7.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.7.1) (2020-10-28) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.7.0...v3.7.1) + + * Upgrade JS SDK to 9.0.1 + * [Release] Fix theme variable passed to Jitsi + [\#5358](https://github.com/matrix-org/matrix-react-sdk/pull/5358) + * [Release] Widget fixes + [\#5351](https://github.com/matrix-org/matrix-react-sdk/pull/5351) + Changes in [3.7.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.7.0) (2020-10-26) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.7.0-rc.2...v3.7.0) From bdfac1d85834306c21df22a21ccc8edf0295776b Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 28 Oct 2020 14:25:35 +0000 Subject: [PATCH 7/7] v3.7.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c19c048696..c427e99766 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.7.0", + "version": "3.7.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {