From 3274e2aed5c43f86d04d80c79a29800ad657caf5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 13 Oct 2020 14:39:27 -0600 Subject: [PATCH 01/17] Run templating on the popout URL too Fixes https://github.com/vector-im/element-web/issues/15443 --- src/stores/widgets/StopGapWidget.ts | 42 +++++++++++++++++------------ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 1eb4f9cd27..f7d6d1853e 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -74,6 +74,16 @@ class ElementWidget extends Widget { return super.templateUrl; } + public get popoutTemplateUrl(): string { + if (WidgetType.JITSI.matches(this.type)) { + return WidgetUtils.getLocalJitsiWrapperUrl({ + forLocalRender: false, // The only important difference between this and templateUrl() + auth: super.rawData?.auth, + }); + } + return this.templateUrl; // use this instead of super to ensure we get appropriate templating + } + public get rawData(): IWidgetData { let conferenceId = super.rawData['conferenceId']; if (conferenceId === undefined) { @@ -94,8 +104,8 @@ class ElementWidget extends Widget { }; } - public getCompleteUrl(params: ITemplateParams): string { - return runTemplate(this.templateUrl, { + public getCompleteUrl(params: ITemplateParams, asPopout=false): string { + return runTemplate(asPopout ? this.popoutTemplateUrl : this.templateUrl, { // we need to supply a whole widget to the template, but don't have // easy access to the definition the superclass is using, so be sad // and gutwrench it. @@ -109,7 +119,7 @@ class ElementWidget extends Widget { export class StopGapWidget extends EventEmitter { private messaging: ClientWidgetApi; - private mockWidget: Widget; + private mockWidget: ElementWidget; private scalarToken: string; constructor(private appTileProps: IAppTileProps) { @@ -133,12 +143,23 @@ export class StopGapWidget extends EventEmitter { * The URL to use in the iframe */ public get embedUrl(): string { + return this.runUrlTemplate({asPopout: false}); + } + + /** + * The URL to use in the popout + */ + public get popoutUrl(): string { + return this.runUrlTemplate({asPopout: true}); + } + + private runUrlTemplate(opts: {asPopout: boolean} = {asPopout: false}): string { const templated = this.mockWidget.getCompleteUrl({ currentRoomId: RoomViewStore.getRoomId(), currentUserId: MatrixClientPeg.get().getUserId(), userDisplayName: OwnProfileStore.instance.displayName, userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(), - }); + }, opts?.asPopout); // Add in some legacy support sprinkles // TODO: Replace these with proper widget params @@ -158,19 +179,6 @@ export class StopGapWidget extends EventEmitter { return parsed.toString().replace(/%24/g, '$'); } - /** - * The URL to use in the popout - */ - public get popoutUrl(): string { - if (WidgetType.JITSI.matches(this.mockWidget.type)) { - return WidgetUtils.getLocalJitsiWrapperUrl({ - forLocalRender: false, - auth: this.mockWidget.rawData?.auth, - }); - } - return this.embedUrl; - } - public get isManagedByManager(): boolean { return !!this.scalarToken; } From f2c874ccb606609c56f86ae730a8741f0959f06c Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 13 Oct 2020 14:55:44 -0600 Subject: [PATCH 02/17] Ensure widgets are destroyed cleanly when minimized Fixes https://github.com/vector-im/element-web/issues/15444 (an artifact of joining a call then minimizing the widget) Also fixes other issues relating to widgets not loading when being minimized/maximized. --- src/components/views/elements/AppTile.js | 9 ++++++++- src/components/views/elements/PersistentApp.js | 5 +++++ src/stores/widgets/StopGapWidget.ts | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index fda2652d12..c732d8ec95 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -240,10 +240,14 @@ export default class AppTile extends React.Component { this.iframe.src = 'about:blank'; } + if (WidgetType.JITSI.matches(this.props.app.type)) { + dis.dispatch({action: 'hangup_conference'}); + } + // Delete the widget from the persisted store for good measure. PersistedElement.destroyElement(this._persistKey); - this._sgWidget.stop(); + this._sgWidget.stop({forceDestroy: true}); } /* If user has permission to modify widgets, delete the widget, @@ -387,6 +391,9 @@ export default class AppTile extends React.Component { if (this.props.show) { // if we were being shown, end the widget as we're about to be minimized. this._endWidgetActions(); + } else { + // restart the widget actions + this._resetWidget(this.props); } dis.dispatch({ action: 'appsDrawer', diff --git a/src/components/views/elements/PersistentApp.js b/src/components/views/elements/PersistentApp.js index a3e413151a..8b2aa5c87c 100644 --- a/src/components/views/elements/PersistentApp.js +++ b/src/components/views/elements/PersistentApp.js @@ -58,6 +58,11 @@ export default class PersistentApp extends React.Component { const persistentWidgetInRoomId = ActiveWidgetStore.getRoomId(this.state.persistentWidgetId); if (this.state.roomId !== persistentWidgetInRoomId) { const persistentWidgetInRoom = MatrixClientPeg.get().getRoom(persistentWidgetInRoomId); + + // Sanity check the room - the widget may have been destroyed between render cycles, and + // thus no room is associated anymore. + if (!persistentWidgetInRoom) return null; + // get the widget data const appEvent = WidgetUtils.getRoomWidgets(persistentWidgetInRoom).find((ev) => { return ev.getStateKey() === ActiveWidgetStore.getPersistentWidgetId(); diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index f7d6d1853e..998dd2afb3 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -283,8 +283,8 @@ export class StopGapWidget extends EventEmitter { } } - public stop() { - if (ActiveWidgetStore.getPersistentWidgetId() === this.mockWidget.id) { + public stop(opts = {forceDestroy: false}) { + if (!opts?.forceDestroy && ActiveWidgetStore.getPersistentWidgetId() === this.mockWidget.id) { console.log("Skipping destroy - persistent widget"); return; } From 7ef4de31159052d470c9079df5ba7fc936837967 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 13 Oct 2020 14:56:27 -0600 Subject: [PATCH 03/17] Appease the linter --- src/stores/widgets/StopGapWidget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 998dd2afb3..41b040b8c6 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -153,7 +153,7 @@ export class StopGapWidget extends EventEmitter { return this.runUrlTemplate({asPopout: true}); } - private runUrlTemplate(opts: {asPopout: boolean} = {asPopout: false}): string { + private runUrlTemplate(opts = {asPopout: false}): string { const templated = this.mockWidget.getCompleteUrl({ currentRoomId: RoomViewStore.getRoomId(), currentUserId: MatrixClientPeg.get().getUserId(), From aa28459b5a0452a1c084e9c222335ddb19dc7587 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 14 Oct 2020 13:54:27 -0600 Subject: [PATCH 04/17] Don't supply popout widgets with widget parameters Fixes https://github.com/vector-im/element-web/issues/15443 --- src/stores/widgets/StopGapWidget.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 41b040b8c6..7f437dfce0 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -161,17 +161,20 @@ export class StopGapWidget extends EventEmitter { userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(), }, opts?.asPopout); - // Add in some legacy support sprinkles + const parsed = new URL(templated); + + // Add in some legacy support sprinkles (for non-popout widgets) // TODO: Replace these with proper widget params // See https://github.com/matrix-org/matrix-doc/pull/1958/files#r405714833 - const parsed = new URL(templated); - parsed.searchParams.set('widgetId', this.mockWidget.id); - parsed.searchParams.set('parentUrl', window.location.href.split('#', 2)[0]); + if (!opts?.asPopout) { + parsed.searchParams.set('widgetId', this.mockWidget.id); + parsed.searchParams.set('parentUrl', window.location.href.split('#', 2)[0]); - // Give the widget a scalar token if we're supposed to (more legacy) - // TODO: Stop doing this - if (this.scalarToken) { - parsed.searchParams.set('scalar_token', this.scalarToken); + // Give the widget a scalar token if we're supposed to (more legacy) + // TODO: Stop doing this + if (this.scalarToken) { + parsed.searchParams.set('scalar_token', this.scalarToken); + } } // Replace the encoded dollar signs back to dollar signs. They have no special meaning From 596c723dea03b8499a85c54b959be48ef8c96cd1 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Oct 2020 10:47:17 +0100 Subject: [PATCH 05/17] Fix Jitsi OpenIDC auth Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/stores/widgets/StopGapWidget.ts | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 7f437dfce0..d0a19285dd 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -17,6 +17,8 @@ import { Room } from "matrix-js-sdk/src/models/room"; import { ClientWidgetApi, + IGetOpenIDActionRequest, + IGetOpenIDActionResponseData, IStickerActionRequest, IStickyActionRequest, ITemplateParams, @@ -25,8 +27,10 @@ import { IWidgetApiRequestEmptyData, IWidgetData, MatrixCapabilities, + OpenIDRequestState, runTemplate, Widget, + WidgetApiToWidgetAction, WidgetApiFromWidgetAction, } from "matrix-widget-api"; import { StopGapWidgetDriver } from "./StopGapWidgetDriver"; @@ -43,6 +47,8 @@ import ActiveWidgetStore from "../ActiveWidgetStore"; import { objectShallowClone } from "../../utils/objects"; import defaultDispatcher from "../../dispatcher/dispatcher"; import { ElementWidgetActions } from "./ElementWidgetActions"; +import Modal from "../../Modal"; +import WidgetOpenIDPermissionsDialog from "../../components/views/dialogs/WidgetOpenIDPermissionsDialog"; // TODO: Destroy all of this code @@ -190,12 +196,66 @@ export class StopGapWidget extends EventEmitter { return !!this.messaging; } + private get widgetId() { + return this.messaging.widget.id; + } + + private onOpenIdReq = async (ev: CustomEvent) => { + if (ev?.detail?.widgetId !== this.widgetId) return; + + const rawUrl = this.appTileProps.app.url; + const widgetSecurityKey = WidgetUtils.getWidgetSecurityKey(this.widgetId, rawUrl, this.appTileProps.userWidget); + + const settings = SettingsStore.getValue("widgetOpenIDPermissions"); + if (settings.deny && settings.deny.includes(widgetSecurityKey)) { + this.messaging.transport.reply(ev.detail, { + state: OpenIDRequestState.Blocked, + }); + return; + } + if (settings.allow && settings.allow.includes(widgetSecurityKey)) { + const credentials = await MatrixClientPeg.get().getOpenIdToken(); + this.messaging.transport.reply(ev.detail, { + state: OpenIDRequestState.Allowed, + ...credentials, + }); + return; + } + + // Confirm that we received the request + this.messaging.transport.reply(ev.detail, { + state: OpenIDRequestState.PendingUserConfirmation, + }); + + // Actually ask for permission to send the user's data + Modal.createTrackedDialog("OpenID widget permissions", '', WidgetOpenIDPermissionsDialog, { + widgetUrl: rawUrl.substr(0, rawUrl.lastIndexOf("?")), + widgetId: this.widgetId, + isUserWidget: this.appTileProps.userWidget, + + onFinished: async (confirm) => { + const responseBody: IGetOpenIDActionResponseData = { + state: confirm ? OpenIDRequestState.Allowed : OpenIDRequestState.Blocked, + original_request_id: ev.detail.requestId, // eslint-disable-line camelcase + }; + if (confirm) { + const credentials = await MatrixClientPeg.get().getOpenIdToken(); + Object.assign(responseBody, credentials); + } + this.messaging.transport.send(WidgetApiToWidgetAction.OpenIDCredentials, responseBody).catch(error => { + console.error("Failed to send OpenID credentials: ", error); + }); + }, + }); + }; + public start(iframe: HTMLIFrameElement) { if (this.started) return; const driver = new StopGapWidgetDriver( this.appTileProps.whitelistCapabilities || []); this.messaging = new ClientWidgetApi(this.mockWidget, iframe, driver); this.messaging.addEventListener("preparing", () => this.emit("preparing")); this.messaging.addEventListener("ready", () => this.emit("ready")); + this.messaging.addEventListener(`action:${WidgetApiFromWidgetAction.GetOpenIDCredentials}`, this.onOpenIdReq); WidgetMessagingStore.instance.storeMessaging(this.mockWidget, this.messaging); if (!this.appTileProps.userWidget && this.appTileProps.room) { From 30adc98a15f151e9938f07abcd4e0e97c91f5570 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Oct 2020 12:34:25 +0100 Subject: [PATCH 06/17] Fix excessive hosting link padding Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/structures/_UserMenu.scss | 4 ++++ src/components/structures/UserMenu.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/res/css/structures/_UserMenu.scss b/res/css/structures/_UserMenu.scss index fecac40e4e..6a352d46a3 100644 --- a/res/css/structures/_UserMenu.scss +++ b/res/css/structures/_UserMenu.scss @@ -230,6 +230,10 @@ limitations under the License. align-items: center; justify-content: center; } + + &.mx_UserMenu_contextMenu_hostingLink { + padding-top: 0; + } } .mx_IconizedContextMenu_icon { diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index 81d25e6a0c..cdf1d8e543 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -257,7 +257,7 @@ export default class UserMenu extends React.Component { const signupLink = getHostingLink("user-context-menu"); if (signupLink) { hostingLink = ( -
+
{_t( "Upgrade to your own domain", {}, { From 9789f8cf94457e55483fcc88b4e0838d8c9427d7 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Oct 2020 12:46:55 +0100 Subject: [PATCH 07/17] Spec compliance, /search doesn't have to return results Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Searching.js | 8 ++++---- src/components/structures/RoomView.tsx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Searching.js b/src/Searching.js index b1507e6a49..f65b8920b3 100644 --- a/src/Searching.js +++ b/src/Searching.js @@ -360,7 +360,7 @@ function combineEvents(previousSearchResult, localEvents = undefined, serverEven let oldestEventFrom = previousSearchResult.oldestEventFrom; response.highlights = previousSearchResult.highlights; - if (localEvents && serverEvents) { + if (localEvents && serverEvents && serverEvents.results) { // This is a first search call, combine the events from the server and // the local index. Note where our oldest event came from, we shall // fetch the next batch of events from the other source. @@ -379,7 +379,7 @@ function combineEvents(previousSearchResult, localEvents = undefined, serverEven oldestEventFrom = "local"; } combineEventSources(previousSearchResult, response, localEvents.results, cachedEvents); - } else if (serverEvents) { + } else if (serverEvents && serverEvents.results) { // This is a pagination call fetching more events from the server, // meaning that our oldest event was in the local index. // Change the source of the oldest event if our server event is older @@ -454,7 +454,7 @@ function combineResponses(previousSearchResult, localEvents = undefined, serverE return response; } -function restoreEncryptionInfo(searchResultSlice) { +function restoreEncryptionInfo(searchResultSlice = []) { for (let i = 0; i < searchResultSlice.length; i++) { const timeline = searchResultSlice[i].context.getTimeline(); @@ -517,7 +517,7 @@ async function combinedPagination(searchResult) { }, }; - const oldResultCount = searchResult.results.length; + const oldResultCount = searchResult.results ? searchResult.results.length : 0; // Let the client process the combined result. const result = client._processRoomEventsSearch(searchResult, response); diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 2952568e2f..0226cecf15 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -1258,7 +1258,7 @@ export default class RoomView extends React.Component { } if (!this.state.searchResults.next_batch) { - if (this.state.searchResults.results.length == 0) { + if (!this.state.searchResults?.results?.length) { ret.push(
  • { _t("No results") }

  • , @@ -1282,7 +1282,7 @@ export default class RoomView extends React.Component { let lastRoomId; - for (let i = this.state.searchResults.results.length - 1; i >= 0; i--) { + for (let i = (this.state.searchResults?.results?.length || 0) - 1; i >= 0; i--) { const result = this.state.searchResults.results[i]; const mxEv = result.context.getEvent(); @@ -1944,7 +1944,7 @@ export default class RoomView extends React.Component { if (this.state.searchResults) { // show searching spinner - if (this.state.searchResults.results === undefined) { + if (this.state.searchResults.count === undefined) { searchResultsPanel = (
    ); From 35d12171b194a9285af10b0c9e87c94cbfa99dcb Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Oct 2020 12:54:53 +0100 Subject: [PATCH 08/17] Remove unused prop for clarity Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/LeftPanel.tsx | 1 - src/components/views/rooms/RoomList.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/src/components/structures/LeftPanel.tsx b/src/components/structures/LeftPanel.tsx index 262d12a700..00653995c9 100644 --- a/src/components/structures/LeftPanel.tsx +++ b/src/components/structures/LeftPanel.tsx @@ -388,7 +388,6 @@ export default class LeftPanel extends React.Component { const roomList = void; onResize: () => void; resizeNotifier: ResizeNotifier; - collapsed: boolean; isMinimized: boolean; } From 47744a4344d1f2582a23f0b5ebe28b790e4d1c90 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Oct 2020 12:55:01 +0100 Subject: [PATCH 09/17] Hide filtering microcopy when left panel is minimized Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomList.tsx b/src/components/views/rooms/RoomList.tsx index 33164837c1..3a4d27e666 100644 --- a/src/components/views/rooms/RoomList.tsx +++ b/src/components/views/rooms/RoomList.tsx @@ -365,7 +365,7 @@ export default class RoomList extends React.PureComponent { public render() { let explorePrompt: JSX.Element; - if (RoomListStore.instance.getFirstNameFilterCondition()) { + if (!this.props.isMinimized && RoomListStore.instance.getFirstNameFilterCondition()) { explorePrompt =
    {_t("Can't see what you’re looking for?")}
    From 11199f89f4e399464aae964c06016b22d5d438ae Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 19 Oct 2020 16:42:20 +0100 Subject: [PATCH 10/17] Adjust for new widget messaging APIs As part of changing to the `events` package, the API surface changed slightly. Related to https://github.com/vector-im/element-web/issues/15493 --- src/stores/widgets/StopGapWidget.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index d0a19285dd..17302d0ab9 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -253,9 +253,9 @@ export class StopGapWidget extends EventEmitter { if (this.started) return; const driver = new StopGapWidgetDriver( this.appTileProps.whitelistCapabilities || []); this.messaging = new ClientWidgetApi(this.mockWidget, iframe, driver); - this.messaging.addEventListener("preparing", () => this.emit("preparing")); - this.messaging.addEventListener("ready", () => this.emit("ready")); - this.messaging.addEventListener(`action:${WidgetApiFromWidgetAction.GetOpenIDCredentials}`, this.onOpenIdReq); + this.messaging.on("preparing", () => this.emit("preparing")); + this.messaging.on("ready", () => this.emit("ready")); + this.messaging.on(`action:${WidgetApiFromWidgetAction.GetOpenIDCredentials}`, this.onOpenIdReq); WidgetMessagingStore.instance.storeMessaging(this.mockWidget, this.messaging); if (!this.appTileProps.userWidget && this.appTileProps.room) { @@ -263,7 +263,7 @@ export class StopGapWidget extends EventEmitter { } if (WidgetType.JITSI.matches(this.mockWidget.type)) { - this.messaging.addEventListener("action:set_always_on_screen", + this.messaging.on("action:set_always_on_screen", (ev: CustomEvent) => { if (this.messaging.hasCapability(MatrixCapabilities.AlwaysOnScreen)) { ActiveWidgetStore.setWidgetPersistence(this.mockWidget.id, ev.detail.data.value); @@ -273,7 +273,7 @@ export class StopGapWidget extends EventEmitter { }, ); } else if (WidgetType.STICKERPICKER.matches(this.mockWidget.type)) { - this.messaging.addEventListener(`action:${ElementWidgetActions.OpenIntegrationManager}`, + this.messaging.on(`action:${ElementWidgetActions.OpenIntegrationManager}`, (ev: CustomEvent) => { // Acknowledge first ev.preventDefault(); @@ -307,7 +307,7 @@ export class StopGapWidget extends EventEmitter { // TODO: Replace this event listener with appropriate driver functionality once the API // establishes a sane way to send events back and forth. - this.messaging.addEventListener(`action:${WidgetApiFromWidgetAction.SendSticker}`, + this.messaging.on(`action:${WidgetApiFromWidgetAction.SendSticker}`, (ev: CustomEvent) => { // Acknowledge first ev.preventDefault(); From 2219419f520d6d4910fc362878d9cf385cfb61c6 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 19 Oct 2020 16:56:33 +0100 Subject: [PATCH 11/17] Upgrade widget API --- package.json | 2 +- yarn.lock | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 71c8074a93..c3336a2ad5 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "linkifyjs": "^2.1.9", "lodash": "^4.17.19", "matrix-js-sdk": "8.5.0", - "matrix-widget-api": "^0.1.0-beta.3", + "matrix-widget-api": "^0.1.0-beta.5", "minimist": "^1.2.5", "pako": "^1.0.11", "parse5": "^5.1.1", diff --git a/yarn.lock b/yarn.lock index 5630ee2b64..481b3ebc38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3791,6 +3791,11 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +events@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379" + integrity sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg== + except@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/except/-/except-0.1.3.tgz#98261c91958551536b44482238e9783fb73d292a" @@ -5954,10 +5959,12 @@ matrix-react-test-utils@^0.2.2: resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853" integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ== -matrix-widget-api@^0.1.0-beta.3: - version "0.1.0-beta.3" - resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.3.tgz#356965ca357172ee056e3fd86fd96879b059a114" - integrity sha512-j7nxdhLQfdU6snsdBA29KQR0DmT8/vl6otOvGqPCV0OCHpq1312cP79Eg4JzJKIFI3A76Qha3nYx6G9/aapwXg== +matrix-widget-api@^0.1.0-beta.5: + version "0.1.0-beta.5" + resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.5.tgz#dd7f24a177aa590d812bd4e92e2c3ac225c5557e" + integrity sha512-J3GBJtVMFuEM/EWFylc0IlkPjdgmWxrkGYPaZ0LSmxp+OlNJxYfnWPR6F6HveW+Z8C1i0vq+BTueofSqKv2zDg== + dependencies: + events "^3.2.0" mdast-util-compact@^1.0.0: version "1.0.4" From 329ded92c114459b525573cd18d7f8133100a5a4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 20 Oct 2020 11:03:03 +0100 Subject: [PATCH 12/17] Convert resizer to Typescript Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/LoggedInView.tsx | 14 +-- .../distributors/{collapse.js => collapse.ts} | 25 ++++-- .../distributors/{fixed.js => fixed.ts} | 20 +++-- src/resizer/{index.js => index.ts} | 6 +- src/resizer/{item.js => item.ts} | 64 ++++++------- src/resizer/{resizer.js => resizer.ts} | 89 +++++++++++-------- src/resizer/{sizer.js => sizer.ts} | 34 +++---- 7 files changed, 141 insertions(+), 111 deletions(-) rename src/resizer/distributors/{collapse.js => collapse.ts} (67%) rename src/resizer/distributors/{fixed.js => fixed.ts} (69%) rename src/resizer/{index.js => index.ts} (76%) rename src/resizer/{item.js => item.ts} (57%) rename src/resizer/{resizer.js => resizer.ts} (62%) rename src/resizer/{sizer.js => sizer.ts} (77%) diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index 15ea20618e..03277a84f9 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -52,6 +52,7 @@ import RoomListStore from "../../stores/room-list/RoomListStore"; import NonUrgentToastContainer from "./NonUrgentToastContainer"; import { ToggleRightPanelPayload } from "../../dispatcher/payloads/ToggleRightPanelPayload"; import { IThreepidInvite } from "../../stores/ThreepidInviteStore"; +import { ICollapseConfig } from "../../resizer/distributors/collapse"; // We need to fetch each pinned message individually (if we don't already have it) // so each pinned message may trigger a request. Limit the number per room for sanity. @@ -205,13 +206,8 @@ class LoggedInView extends React.Component { }; _createResizer() { - const classNames = { - handle: "mx_ResizeHandle", - vertical: "mx_ResizeHandle_vertical", - reverse: "mx_ResizeHandle_reverse", - }; let size; - const collapseConfig = { + const collapseConfig: ICollapseConfig = { toggleSize: 260 - 50, onCollapsed: (collapsed) => { if (collapsed) { @@ -234,7 +230,11 @@ class LoggedInView extends React.Component { }, }; const resizer = new Resizer(this._resizeContainer.current, CollapseDistributor, collapseConfig); - resizer.setClassNames(classNames); + resizer.setClassNames({ + handle: "mx_ResizeHandle", + vertical: "mx_ResizeHandle_vertical", + reverse: "mx_ResizeHandle_reverse", + }); return resizer; } diff --git a/src/resizer/distributors/collapse.js b/src/resizer/distributors/collapse.ts similarity index 67% rename from src/resizer/distributors/collapse.js rename to src/resizer/distributors/collapse.ts index 784532a0eb..19d72e968b 100644 --- a/src/resizer/distributors/collapse.js +++ b/src/resizer/distributors/collapse.ts @@ -16,9 +16,16 @@ limitations under the License. import FixedDistributor from "./fixed"; import ResizeItem from "../item"; +import Resizer, {IConfig} from "../resizer"; +import Sizer from "../sizer"; -class CollapseItem extends ResizeItem { - notifyCollapsed(collapsed) { +export interface ICollapseConfig extends IConfig { + toggleSize: number; + onCollapsed?(collapsed: boolean, id: string, element: HTMLElement): void; +} + +class CollapseItem extends ResizeItem { + notifyCollapsed(collapsed: boolean) { const callback = this.resizer.config.onCollapsed; if (callback) { callback(collapsed, this.id, this.domNode); @@ -26,18 +33,20 @@ class CollapseItem extends ResizeItem { } } -export default class CollapseDistributor extends FixedDistributor { - static createItem(resizeHandle, resizer, sizer) { +export default class CollapseDistributor extends FixedDistributor { + static createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer) { return new CollapseItem(resizeHandle, resizer, sizer); } - constructor(item, config) { + private readonly toggleSize: number; + private isCollapsed = false; + + constructor(item: CollapseItem) { super(item); - this.toggleSize = config && config.toggleSize; - this.isCollapsed = false; + this.toggleSize = item.resizer?.config?.toggleSize; } - resize(newSize) { + public resize(newSize: number) { const isCollapsedSize = newSize < this.toggleSize; if (isCollapsedSize && !this.isCollapsed) { this.isCollapsed = true; diff --git a/src/resizer/distributors/fixed.js b/src/resizer/distributors/fixed.ts similarity index 69% rename from src/resizer/distributors/fixed.js rename to src/resizer/distributors/fixed.ts index e93c6fbcee..d901c4fcb6 100644 --- a/src/resizer/distributors/fixed.js +++ b/src/resizer/distributors/fixed.ts @@ -16,6 +16,7 @@ limitations under the License. import ResizeItem from "../item"; import Sizer from "../sizer"; +import Resizer, {IConfig} from "../resizer"; /** distributors translate a moving cursor into @@ -27,29 +28,30 @@ they have two methods: within the container bounding box. For internal use. This method usually ends up calling `resize` once the start offset is subtracted. */ -export default class FixedDistributor { - static createItem(resizeHandle, resizer, sizer) { +export default class FixedDistributor = ResizeItem> { + static createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer): ResizeItem { return new ResizeItem(resizeHandle, resizer, sizer); } - static createSizer(containerElement, vertical, reverse) { + static createSizer(containerElement: HTMLElement, vertical: boolean, reverse: boolean): Sizer { return new Sizer(containerElement, vertical, reverse); } - constructor(item) { - this.item = item; + private readonly beforeOffset: number; + + constructor(public readonly item: I) { this.beforeOffset = item.offset(); } - resize(size) { + public resize(size: number) { this.item.setSize(size); } - resizeFromContainerOffset(offset) { + public resizeFromContainerOffset(offset: number) { this.resize(offset - this.beforeOffset); } - start() {} + public start() {} - finish() {} + public finish() {} } diff --git a/src/resizer/index.js b/src/resizer/index.ts similarity index 76% rename from src/resizer/index.js rename to src/resizer/index.ts index 1fd8f4da46..da015715d0 100644 --- a/src/resizer/index.js +++ b/src/resizer/index.ts @@ -15,6 +15,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -export FixedDistributor from "./distributors/fixed"; -export CollapseDistributor from "./distributors/collapse"; -export Resizer from "./resizer"; +export {default as FixedDistributor} from "./distributors/fixed"; +export {default as CollapseDistributor} from "./distributors/collapse"; +export {default as Resizer} from "./resizer"; diff --git a/src/resizer/item.js b/src/resizer/item.ts similarity index 57% rename from src/resizer/item.js rename to src/resizer/item.ts index 2e06ad217c..ec60b593e5 100644 --- a/src/resizer/item.js +++ b/src/resizer/item.ts @@ -14,25 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. */ -export default class ResizeItem { - constructor(handle, resizer, sizer) { - const id = handle.getAttribute("data-id"); - const reverse = resizer.isReverseResizeHandle(handle); - const domNode = reverse ? handle.nextElementSibling : handle.previousElementSibling; +import Resizer, {IConfig} from "./resizer"; +import Sizer from "./sizer"; - this.domNode = domNode; - this.id = id; - this.reverse = reverse; - this.resizer = resizer; - this.sizer = sizer; +export default class ResizeItem { + public readonly domNode: HTMLElement; + protected readonly id: string; + protected reverse: boolean; + + constructor( + handle: HTMLElement, + public readonly resizer: Resizer, + public readonly sizer: Sizer, + ) { + this.reverse = resizer.isReverseResizeHandle(handle); + this.domNode = (this.reverse ? handle.nextElementSibling : handle.previousElementSibling); + this.id = handle.getAttribute("data-id"); } - _copyWith(handle, resizer, sizer) { - const Ctor = this.constructor; + private copyWith(handle: HTMLElement, resizer: Resizer, sizer: Sizer) { + const Ctor = this.constructor as typeof ResizeItem; return new Ctor(handle, resizer, sizer); } - _advance(forwards) { + private advance(forwards: boolean) { // opposite direction from fromResizeHandle to get back to handle let handle = this.reverse ? this.domNode.previousElementSibling : @@ -45,32 +50,32 @@ export default class ResizeItem { } else { handle = handle.previousElementSibling; } - } while (handle && !this.resizer.isResizeHandle(handle)); + } while (handle && !this.resizer.isResizeHandle(handle)); if (handle) { - const nextHandle = this._copyWith(handle, this.resizer, this.sizer); + const nextHandle = this.copyWith(handle, this.resizer, this.sizer); nextHandle.reverse = this.reverse; return nextHandle; } } - next() { - return this._advance(true); + public next() { + return this.advance(true); } - previous() { - return this._advance(false); + public previous() { + return this.advance(false); } - size() { + public size() { return this.sizer.getItemSize(this.domNode); } - offset() { + public offset() { return this.sizer.getItemOffset(this.domNode); } - setSize(size) { + public setSize(size: number) { this.sizer.setItemSize(this.domNode, size); const callback = this.resizer.config.onResized; if (callback) { @@ -78,7 +83,7 @@ export default class ResizeItem { } } - clearSize() { + public clearSize() { this.sizer.clearItemSize(this.domNode); const callback = this.resizer.config.onResized; if (callback) { @@ -86,22 +91,21 @@ export default class ResizeItem { } } - - first() { + public first() { const firstHandle = Array.from(this.domNode.parentElement.children).find(el => { - return this.resizer.isResizeHandle(el); + return this.resizer.isResizeHandle(el); }); if (firstHandle) { - return this._copyWith(firstHandle, this.resizer, this.sizer); + return this.copyWith(firstHandle, this.resizer, this.sizer); } } - last() { + public last() { const lastHandle = Array.from(this.domNode.parentElement.children).reverse().find(el => { - return this.resizer.isResizeHandle(el); + return this.resizer.isResizeHandle(el); }); if (lastHandle) { - return this._copyWith(lastHandle, this.resizer, this.sizer); + return this.copyWith(lastHandle, this.resizer, this.sizer); } } } diff --git a/src/resizer/resizer.js b/src/resizer/resizer.ts similarity index 62% rename from src/resizer/resizer.js rename to src/resizer/resizer.ts index 1e75bf3bdf..f296b733e0 100644 --- a/src/resizer/resizer.js +++ b/src/resizer/resizer.ts @@ -1,6 +1,6 @@ /* Copyright 2018 New Vector Ltd -Copyright 2019 The Matrix.org Foundation C.I.C. +Copyright 2019, 2020 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. @@ -15,86 +15,101 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* -classNames: +import FixedDistributor from "./distributors/fixed"; +import ResizeItem from "./item"; +import Sizer from "./sizer"; + +interface IClassNames { // class on resize-handle - handle: string + handle?: string; // class on resize-handle - reverse: string + reverse?: string; // class on resize-handle - vertical: string + vertical?: string; // class on container - resizing: string -*/ + resizing?: string; +} +export interface IConfig { + onResizeStart?(): void; + onResizeStop?(): void; + onResized?(size: number, id: string, element: HTMLElement): void; +} + +export default class Resizer { + private classNames: IClassNames; -export default class Resizer { // TODO move vertical/horizontal to config option/container class // as it doesn't make sense to mix them within one container/Resizer - constructor(container, distributorCtor, config) { + constructor( + public container: HTMLElement, + private readonly distributorCtor: { + new(item: ResizeItem): FixedDistributor; + createItem(resizeHandle: HTMLDivElement, resizer: Resizer, sizer: Sizer): ResizeItem; + createSizer(containerElement: HTMLElement, vertical: boolean, reverse: boolean): Sizer; + }, + public readonly config?: C, + ) { if (!container) { throw new Error("Resizer requires a non-null `container` arg"); } - this.container = container; - this.distributorCtor = distributorCtor; - this.config = config; + this.classNames = { handle: "resizer-handle", reverse: "resizer-reverse", vertical: "resizer-vertical", resizing: "resizer-resizing", }; - this._onMouseDown = this._onMouseDown.bind(this); } - setClassNames(classNames) { + public setClassNames(classNames: IClassNames) { this.classNames = classNames; } - attach() { - this.container.addEventListener("mousedown", this._onMouseDown, false); + public attach() { + this.container.addEventListener("mousedown", this.onMouseDown, false); } - detach() { - this.container.removeEventListener("mousedown", this._onMouseDown, false); + public detach() { + this.container.removeEventListener("mousedown", this.onMouseDown, false); } /** Gives the distributor for a specific resize handle, as if you would have started to drag that handle. Can be used to manipulate the size of an item programmatically. @param {number} handleIndex the index of the resize handle in the container - @return {Distributor} a new distributor for the given handle + @return {FixedDistributor} a new distributor for the given handle */ - forHandleAt(handleIndex) { - const handles = this._getResizeHandles(); + public forHandleAt(handleIndex: number): FixedDistributor { + const handles = this.getResizeHandles(); const handle = handles[handleIndex]; if (handle) { - const {distributor} = this._createSizerAndDistributor(handle); + const {distributor} = this.createSizerAndDistributor(handle); return distributor; } } - forHandleWithId(id) { - const handles = this._getResizeHandles(); + public forHandleWithId(id: string): FixedDistributor { + const handles = this.getResizeHandles(); const handle = handles.find((h) => h.getAttribute("data-id") === id); if (handle) { - const {distributor} = this._createSizerAndDistributor(handle); + const {distributor} = this.createSizerAndDistributor(handle); return distributor; } } - isReverseResizeHandle(el) { + public isReverseResizeHandle(el: HTMLElement) { return el && el.classList.contains(this.classNames.reverse); } - isResizeHandle(el) { + public isResizeHandle(el: HTMLElement) { return el && el.classList.contains(this.classNames.handle); } - _onMouseDown(event) { + private onMouseDown = (event: MouseEvent) => { // use closest in case the resize handle contains // child dom nodes that can be the target - const resizeHandle = event.target && event.target.closest(`.${this.classNames.handle}`); + const resizeHandle = event.target && (event.target).closest(`.${this.classNames.handle}`); if (!resizeHandle || resizeHandle.parentElement !== this.container) { return; } @@ -109,7 +124,7 @@ export default class Resizer { this.config.onResizeStart(); } - const {sizer, distributor} = this._createSizerAndDistributor(resizeHandle); + const {sizer, distributor} = this.createSizerAndDistributor(resizeHandle); distributor.start(); const onMouseMove = (event) => { @@ -133,21 +148,21 @@ export default class Resizer { body.addEventListener("mouseup", finishResize, false); document.addEventListener("mouseleave", finishResize, false); body.addEventListener("mousemove", onMouseMove, false); - } + }; - _createSizerAndDistributor(resizeHandle) { + private createSizerAndDistributor(resizeHandle: HTMLDivElement) { const vertical = resizeHandle.classList.contains(this.classNames.vertical); const reverse = this.isReverseResizeHandle(resizeHandle); const Distributor = this.distributorCtor; const sizer = Distributor.createSizer(this.container, vertical, reverse); const item = Distributor.createItem(resizeHandle, this, sizer); - const distributor = new Distributor(item, this.config); + const distributor = new Distributor(item); return {sizer, distributor}; } - _getResizeHandles() { + private getResizeHandles(): HTMLDivElement[] { return Array.from(this.container.children).filter(el => { - return this.isResizeHandle(el); - }); + return this.isResizeHandle(el); + }) as HTMLDivElement[]; } } diff --git a/src/resizer/sizer.js b/src/resizer/sizer.ts similarity index 77% rename from src/resizer/sizer.js rename to src/resizer/sizer.ts index 4ce9232457..54e21c1483 100644 --- a/src/resizer/sizer.js +++ b/src/resizer/sizer.ts @@ -19,18 +19,18 @@ implements DOM/CSS operations for resizing. The sizer determines what CSS mechanism is used for sizing items, like flexbox, ... */ export default class Sizer { - constructor(container, vertical, reverse) { - this.container = container; - this.reverse = reverse; - this.vertical = vertical; - } + constructor( + protected readonly container: HTMLElement, + protected readonly vertical: boolean, + protected readonly reverse: boolean, + ) {} /** @param {Element} item the dom element being resized @return {number} how far the edge of the item is from the edge of the container */ - getItemOffset(item) { - const offset = (this.vertical ? item.offsetTop : item.offsetLeft) - this._getOffset(); + public getItemOffset(item: HTMLElement): number { + const offset = (this.vertical ? item.offsetTop : item.offsetLeft) - this.getOffset(); if (this.reverse) { return this.getTotalSize() - (offset + this.getItemSize(item)); } else { @@ -42,33 +42,33 @@ export default class Sizer { @param {Element} item the dom element being resized @return {number} the width/height of an item in the container */ - getItemSize(item) { + public getItemSize(item: HTMLElement): number { return this.vertical ? item.offsetHeight : item.offsetWidth; } /** @return {number} the width/height of the container */ - getTotalSize() { + public getTotalSize(): number { return this.vertical ? this.container.offsetHeight : this.container.offsetWidth; } /** @return {number} container offset to offsetParent */ - _getOffset() { + private getOffset(): number { return this.vertical ? this.container.offsetTop : this.container.offsetLeft; } /** @return {number} container offset to document */ - _getPageOffset() { + private getPageOffset(): number { let element = this.container; let offset = 0; while (element) { const pos = this.vertical ? element.offsetTop : element.offsetLeft; offset = offset + pos; - element = element.offsetParent; + element = element.offsetParent; } return offset; } - setItemSize(item, size) { + public setItemSize(item: HTMLElement, size: number) { if (this.vertical) { item.style.height = `${Math.round(size)}px`; } else { @@ -76,7 +76,7 @@ export default class Sizer { } } - clearItemSize(item) { + public clearItemSize(item: HTMLElement) { if (this.vertical) { item.style.height = null; } else { @@ -89,12 +89,12 @@ export default class Sizer { @return {number} the distance between the cursor and the edge of the container, along the applicable axis (vertical or horizontal) */ - offsetFromEvent(event) { + public offsetFromEvent(event: MouseEvent) { const pos = this.vertical ? event.pageY : event.pageX; if (this.reverse) { - return (this._getPageOffset() + this.getTotalSize()) - pos; + return (this.getPageOffset() + this.getTotalSize()) - pos; } else { - return pos - this._getPageOffset(); + return pos - this.getPageOffset(); } } } From 10fbdef6d62245c19f40b4d1e5a64c92d4ad77a4 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 20 Oct 2020 11:23:48 +0100 Subject: [PATCH 13/17] Prepare changelog for v3.6.1 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a22954c3f..34a3498f9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Changes in [3.6.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.6.1) (2020-10-20) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.6.0...v3.6.1) + + * [Release] Adjust for new widget messaging APIs + [\#5342](https://github.com/matrix-org/matrix-react-sdk/pull/5342) + * [Release] Fix Jitsi OpenIDC auth + [\#5335](https://github.com/matrix-org/matrix-react-sdk/pull/5335) + Changes in [3.6.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.6.0) (2020-10-12) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.6.0-rc.1...v3.6.0) From 3b90ed0664c3bdae558f75ed612f4a9fb965591b Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 20 Oct 2020 11:23:48 +0100 Subject: [PATCH 14/17] v3.6.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c3336a2ad5..2bda5c8b6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.6.0", + "version": "3.6.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From bd1276c56b42806c17b8e069f135072cd01b1541 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 20 Oct 2020 11:27:33 +0100 Subject: [PATCH 15/17] Reset matrix-js-sdk back to develop branch --- package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f180728d81..bb47fc6401 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": "8.5.0", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "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 a06e8bc62d..cb38828d0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6507,7 +6507,7 @@ mathml-tag-names@^2.0.1: "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "8.5.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/d8c4101fdd521e189f4755c6f02a8971b991ef5f" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/9f713781cdfea2349115ffaac2d665e8b07fd5dc" dependencies: "@babel/runtime" "^7.11.2" another-json "^0.2.0" From 31cc3765e3afb3be620162eda98c7feb2dd554c3 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 20 Oct 2020 11:55:48 +0100 Subject: [PATCH 16/17] Skip editor confirmation of upgrades In practice, the upgrades are always fine, and this editor prompt just adds delays. --- release.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/release.sh b/release.sh index e2cefcbe74..4742f00dea 100755 --- a/release.sh +++ b/release.sh @@ -32,9 +32,7 @@ do echo "Upgrading $i to $latestver..." yarn add -E $i@$latestver git add -u - # The `-e` flag opens the editor and gives you a chance to check - # the upgrade for correctness. - git commit -m "Upgrade $i to $latestver" -e + git commit -m "Upgrade $i to $latestver" fi fi done From 01498653d841896a59d65d03655d880831054beb Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 20 Oct 2020 23:42:12 +0100 Subject: [PATCH 17/17] update copyrights --- src/resizer/distributors/collapse.ts | 2 +- src/resizer/distributors/fixed.ts | 2 +- src/resizer/index.ts | 1 - src/resizer/item.ts | 2 +- src/resizer/resizer.ts | 3 +-- src/resizer/sizer.ts | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/resizer/distributors/collapse.ts b/src/resizer/distributors/collapse.ts index 19d72e968b..ddf3bd687e 100644 --- a/src/resizer/distributors/collapse.ts +++ b/src/resizer/distributors/collapse.ts @@ -1,5 +1,5 @@ /* -Copyright 2019 New Vector Ltd +Copyright 2019 - 2020 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. diff --git a/src/resizer/distributors/fixed.ts b/src/resizer/distributors/fixed.ts index d901c4fcb6..59ed845467 100644 --- a/src/resizer/distributors/fixed.ts +++ b/src/resizer/distributors/fixed.ts @@ -1,5 +1,5 @@ /* -Copyright 2019 New Vector Ltd +Copyright 2019 - 2020 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. diff --git a/src/resizer/index.ts b/src/resizer/index.ts index da015715d0..e0e72ff159 100644 --- a/src/resizer/index.ts +++ b/src/resizer/index.ts @@ -1,5 +1,4 @@ /* -Copyright 2018 New Vector Ltd Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/resizer/item.ts b/src/resizer/item.ts index ec60b593e5..1b42c19a4a 100644 --- a/src/resizer/item.ts +++ b/src/resizer/item.ts @@ -1,5 +1,5 @@ /* -Copyright 2019 New Vector Ltd +Copyright 2019 - 2020 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. diff --git a/src/resizer/resizer.ts b/src/resizer/resizer.ts index f296b733e0..b8a6777da0 100644 --- a/src/resizer/resizer.ts +++ b/src/resizer/resizer.ts @@ -1,6 +1,5 @@ /* -Copyright 2018 New Vector Ltd -Copyright 2019, 2020 The Matrix.org Foundation C.I.C. +Copyright 2018 - 2020 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. diff --git a/src/resizer/sizer.ts b/src/resizer/sizer.ts index 54e21c1483..4630ffd6bf 100644 --- a/src/resizer/sizer.ts +++ b/src/resizer/sizer.ts @@ -1,5 +1,5 @@ /* -Copyright 2018 New Vector Ltd +Copyright 2018 - 2020 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.