From 43ff97c1789be080b8ec69e3045d7a262e3dfd31 Mon Sep 17 00:00:00 2001 From: Daniel Maslowski Date: Wed, 9 Sep 2020 20:35:26 +0200 Subject: [PATCH 01/20] Add support for giving reason when redacting Signed-off-by: Daniel Maslowski --- src/components/views/context_menus/MessageContextMenu.js | 4 +++- src/components/views/dialogs/ConfirmRedactDialog.js | 8 +++++--- src/i18n/strings/en_EN.json | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index d760c8defa..b6d27e45f9 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -145,7 +145,7 @@ export default class MessageContextMenu extends React.Component { onRedactClick = () => { const ConfirmRedactDialog = sdk.getComponent("dialogs.ConfirmRedactDialog"); Modal.createTrackedDialog('Confirm Redact Dialog', '', ConfirmRedactDialog, { - onFinished: async (proceed) => { + onFinished: async (proceed, reason) => { if (!proceed) return; const cli = MatrixClientPeg.get(); @@ -153,6 +153,8 @@ export default class MessageContextMenu extends React.Component { await cli.redactEvent( this.props.mxEvent.getRoomId(), this.props.mxEvent.getId(), + undefined, + reason ? { reason } : {}, ); } catch (e) { const code = e.errcode || e.statusCode; diff --git a/src/components/views/dialogs/ConfirmRedactDialog.js b/src/components/views/dialogs/ConfirmRedactDialog.js index 3106df1d5b..2216f9a93a 100644 --- a/src/components/views/dialogs/ConfirmRedactDialog.js +++ b/src/components/views/dialogs/ConfirmRedactDialog.js @@ -23,15 +23,17 @@ import { _t } from '../../../languageHandler'; */ export default class ConfirmRedactDialog extends React.Component { render() { - const QuestionDialog = sdk.getComponent('views.dialogs.QuestionDialog'); + const TextInputDialog = sdk.getComponent('views.dialogs.TextInputDialog'); return ( - - + ); } } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 65374ea3ec..ecc4bd2f4c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1624,6 +1624,7 @@ "Removing…": "Removing…", "Confirm Removal": "Confirm Removal", "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.", + "Reason (optional)": "Reason (optional)", "Clear all data in this session?": "Clear all data in this session?", "Clearing all data from this session is permanent. Encrypted messages will be lost unless their keys have been backed up.": "Clearing all data from this session is permanent. Encrypted messages will be lost unless their keys have been backed up.", "Clear all data": "Clear all data", From ed59b504480f943c3ddc2dbc55c81ab980e714cd Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 2 Dec 2020 14:25:55 +0000 Subject: [PATCH 02/20] Upgrade matrix-js-sdk to 9.3.0-rc.1 --- package.json | 4 ++-- yarn.lock | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index f3b8104663..76723bb12d 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "blueimp-canvas-to-blob": "^3.27.0", "browser-encrypt-attachment": "^0.3.0", "browser-request": "^0.3.3", + "cheerio": "^1.0.0-rc.3", "classnames": "^2.2.6", "commonmark": "^0.29.1", "counterpart": "^0.18.6", @@ -77,10 +78,9 @@ "html-entities": "^1.3.1", "is-ip": "^2.0.0", "katex": "^0.12.0", - "cheerio": "^1.0.0-rc.3", "linkifyjs": "^2.1.9", "lodash": "^4.17.19", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", + "matrix-js-sdk": "9.3.0-rc.1", "matrix-widget-api": "^0.1.0-beta.10", "minimist": "^1.2.5", "pako": "^1.0.11", diff --git a/yarn.lock b/yarn.lock index c06494d319..2a49110d58 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1256,10 +1256,10 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.11.2": - version "7.11.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736" - integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw== +"@babel/runtime@^7.12.5": + version "7.12.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" + integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg== dependencies: regenerator-runtime "^0.13.4" @@ -6390,10 +6390,10 @@ log-symbols@^2.0.0, log-symbols@^2.2.0: dependencies: chalk "^2.0.1" -loglevel@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.0.tgz#728166855a740d59d38db01cf46f042caa041bb0" - integrity sha512-i2sY04nal5jDcagM3FMfG++T69GEEM8CYuOfeOIvmXzOIcwE9a/CJPR0MFM97pYMj/u10lzz7/zd7+qwhrBTqQ== +loglevel@^1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197" + integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw== lolex@^5.0.0, lolex@^5.1.2: version "5.1.2" @@ -6512,16 +6512,17 @@ 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@github:matrix-org/matrix-js-sdk#develop": - version "9.2.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/6661bde6088e6e43f31198e8532432e162aef33c" +matrix-js-sdk@9.3.0-rc.1: + version "9.3.0-rc.1" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.3.0-rc.1.tgz#d6ad2d9a5e0c539c6aec9e587a6dd2b5aa8bf2f6" + integrity sha512-H20QLwsgzBIO0Lp75CYBlw4QTOHT98vCESNZrnjIsu8FlFqsXIhdTa5C8BIYsNLex5luufxdp2an5BQtJEuAUQ== dependencies: - "@babel/runtime" "^7.11.2" + "@babel/runtime" "^7.12.5" another-json "^0.2.0" browser-request "^0.3.3" bs58 "^4.0.1" content-type "^1.0.4" - loglevel "^1.7.0" + loglevel "^1.7.1" qs "^6.9.4" request "^2.88.2" unhomoglyph "^1.0.6" From 054dff31d5ec472551e4ea7ed88e6a4e40fb522d Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 2 Dec 2020 14:38:28 +0000 Subject: [PATCH 03/20] Prepare changelog for v3.10.0-rc.1 --- CHANGELOG.md | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aac4e2974..6fa0612695 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,80 @@ +Changes in [3.10.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.10.0-rc.1) (2020-12-02) +=============================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.9.0...v3.10.0-rc.1) + + * Upgrade to JS SDK 9.3.0-rc.1 + * Translations update from Weblate + [\#5461](https://github.com/matrix-org/matrix-react-sdk/pull/5461) + * Fix VoIP call plinth on dark theme + [\#5460](https://github.com/matrix-org/matrix-react-sdk/pull/5460) + * Add sanity checking around widget pinning + [\#5459](https://github.com/matrix-org/matrix-react-sdk/pull/5459) + * Update i18n for Appearance User Settings + [\#5457](https://github.com/matrix-org/matrix-react-sdk/pull/5457) + * Only show 'answered elsewhere' if we tried to answer too + [\#5455](https://github.com/matrix-org/matrix-react-sdk/pull/5455) + * Fixed Avatar for 3PID invites + [\#5442](https://github.com/matrix-org/matrix-react-sdk/pull/5442) + * Slightly better error if we can't capture user media + [\#5449](https://github.com/matrix-org/matrix-react-sdk/pull/5449) + * Make it possible in-code to hide rooms from the room list + [\#5445](https://github.com/matrix-org/matrix-react-sdk/pull/5445) + * Fix the stickerpicker + [\#5447](https://github.com/matrix-org/matrix-react-sdk/pull/5447) + * Add live password validation to change password dialog + [\#5436](https://github.com/matrix-org/matrix-react-sdk/pull/5436) + * LaTeX rendering in element-web using KaTeX + [\#5244](https://github.com/matrix-org/matrix-react-sdk/pull/5244) + * Add lifecycle customisation point after logout + [\#5448](https://github.com/matrix-org/matrix-react-sdk/pull/5448) + * Simplify UserMenu for Guests as they can't use most of the options + [\#5421](https://github.com/matrix-org/matrix-react-sdk/pull/5421) + * Fix known issues with modal widgets + [\#5444](https://github.com/matrix-org/matrix-react-sdk/pull/5444) + * Fix existing widgets not having approved capabilities for their function + [\#5443](https://github.com/matrix-org/matrix-react-sdk/pull/5443) + * Use the WidgetDriver to run OIDC requests + [\#5440](https://github.com/matrix-org/matrix-react-sdk/pull/5440) + * Add a customisation point for widget permissions and fix amnesia issues + [\#5439](https://github.com/matrix-org/matrix-react-sdk/pull/5439) + * Fix Widget event notification text including spurious space + [\#5441](https://github.com/matrix-org/matrix-react-sdk/pull/5441) + * Move call listener out of MatrixChat + [\#5438](https://github.com/matrix-org/matrix-react-sdk/pull/5438) + * New Look in-Call View + [\#5432](https://github.com/matrix-org/matrix-react-sdk/pull/5432) + * Support arbitrary widgets sticking to the screen + sending stickers + [\#5435](https://github.com/matrix-org/matrix-react-sdk/pull/5435) + * Auth typescripting and validation tweaks + [\#5433](https://github.com/matrix-org/matrix-react-sdk/pull/5433) + * Add new widget API actions for changing rooms and sending/receiving events + [\#5385](https://github.com/matrix-org/matrix-react-sdk/pull/5385) + * Revert room header click behaviour to opening room settings + [\#5434](https://github.com/matrix-org/matrix-react-sdk/pull/5434) + * Add option to send/edit a message with Ctrl + Enter / Command + Enter + [\#5160](https://github.com/matrix-org/matrix-react-sdk/pull/5160) + * Add Analytics instrumentation to the Homepage + [\#5409](https://github.com/matrix-org/matrix-react-sdk/pull/5409) + * Fix encrypted video playback in Chrome-based browsers + [\#5430](https://github.com/matrix-org/matrix-react-sdk/pull/5430) + * Add border-radius for video + [\#5333](https://github.com/matrix-org/matrix-react-sdk/pull/5333) + * Push name to the end, near text, in IRC layout + [\#5166](https://github.com/matrix-org/matrix-react-sdk/pull/5166) + * Disable notifications for the room you have recently been active in + [\#5325](https://github.com/matrix-org/matrix-react-sdk/pull/5325) + * Search through the list of unfiltered rooms rather than the rooms in the + state which are already filtered by the search text + [\#5331](https://github.com/matrix-org/matrix-react-sdk/pull/5331) + * Lighten blockquote colour in dark mode + [\#5353](https://github.com/matrix-org/matrix-react-sdk/pull/5353) + * Specify community description img must be mxc urls + [\#5364](https://github.com/matrix-org/matrix-react-sdk/pull/5364) + * Add keyboard shortcut to close the current conversation + [\#5253](https://github.com/matrix-org/matrix-react-sdk/pull/5253) + * Redirect user home from auth screens if they are already logged in + [\#5423](https://github.com/matrix-org/matrix-react-sdk/pull/5423) + Changes in [3.9.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.9.0) (2020-11-23) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.9.0-rc.1...v3.9.0) From db354ff888a44f4560d05580e83edd7a00bb307d Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 2 Dec 2020 14:38:28 +0000 Subject: [PATCH 04/20] v3.10.0-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 76723bb12d..7eff8cf388 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.9.0", + "version": "3.10.0-rc.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From d38a6ad1be80b2f915335507c97ba15c1e6d9e47 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 2 Dec 2020 12:20:59 -0700 Subject: [PATCH 05/20] Add more widget sanity checking This is for https://github.com/vector-im/element-web/issues/15705 https://github.com/matrix-org/matrix-react-sdk/pull/5459 was unable to track down all the instances of where the issue happens, so this commit tries to do a more complete job. Specifically, this replaces the getRoomId() function given widgets cannot reliably be referenced by widget ID in this way, and the store has been updated to handle a more unique widget ID for the store (just in case). Further sanity checking has also been added to ensure that we are at least returning a valid result. --- src/stores/WidgetStore.ts | 57 +++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/src/stores/WidgetStore.ts b/src/stores/WidgetStore.ts index 8e08fc016c..f1b5ea9be0 100644 --- a/src/stores/WidgetStore.ts +++ b/src/stores/WidgetStore.ts @@ -29,6 +29,8 @@ import WidgetUtils from "../utils/WidgetUtils"; import {SettingLevel} from "../settings/SettingLevel"; import {WidgetType} from "../widgets/WidgetType"; import {UPDATE_EVENT} from "./AsyncStore"; +import { MatrixClientPeg } from "../MatrixClientPeg"; +import { arrayDiff, arrayHasDiff, arrayUnion } from "../utils/arrays"; interface IState {} @@ -48,13 +50,16 @@ interface IRoomWidgets { export const MAX_PINNED = 3; +function widgetUid(app: IApp): string { + return `${app.roomId ?? MatrixClientPeg.get().getUserId()}::${app.id}`; +} + // TODO consolidate WidgetEchoStore into this // TODO consolidate ActiveWidgetStore into this export default class WidgetStore extends AsyncStoreWithClient { private static internalInstance = new WidgetStore(); - // TODO: Come up with a unique key for widgets as their IDs are not globally unique, but can exist anywhere - private widgetMap = new Map(); // Key is widget ID + private widgetMap = new Map(); // Key is widget Unique ID (UID) private roomMap = new Map(); // Key is room ID private constructor() { @@ -129,14 +134,12 @@ export default class WidgetStore extends AsyncStoreWithClient { // 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.widgetMap.delete(widgetUid(app)); }); this.generateApps(room).forEach(app => { // Sanity check for https://github.com/vector-im/element-web/issues/15705 - const existingApp = this.widgetMap.get(app.id); + const existingApp = this.widgetMap.get(widgetUid(app)); if (existingApp) { console.warn( `Possible widget ID conflict for ${app.id} - wants to store in room ${app.roomId} ` + @@ -144,7 +147,7 @@ export default class WidgetStore extends AsyncStoreWithClient { ); } - this.widgetMap.set(app.id, app); + this.widgetMap.set(widgetUid(app), app); roomInfo.widgets.push(app); }); this.emit(room.roomId); @@ -158,19 +161,6 @@ export default class WidgetStore extends AsyncStoreWithClient { this.emit(UPDATE_EVENT); }; - public getRoomId = (widgetId: string) => { - const app = this.widgetMap.get(widgetId); - if (!app) return null; - - // Sanity check for https://github.com/vector-im/element-web/issues/15705 - const roomInfo = this.getRoom(app.roomId); - if (!roomInfo.widgets?.some(w => w.id === app.id)) { - throw new Error(`Widget ${app.id} says it is in ${app.roomId} but was not found there`); - } - - return app.roomId; - } - public getRoom = (roomId: string) => { return this.roomMap.get(roomId); }; @@ -220,7 +210,7 @@ export default class WidgetStore extends AsyncStoreWithClient { this.setPinned(roomId, widgetId, true); // Show the apps drawer upon the user pinning a widget - if (RoomViewStore.getRoomId() === this.getRoomId(widgetId)) { + if (RoomViewStore.getRoomId() === roomId) { defaultDispatcher.dispatch({ action: "appsDrawer", show: true, @@ -295,12 +285,33 @@ export default class WidgetStore extends AsyncStoreWithClient { }); const order = Object.keys(roomInfo.pinned).filter(k => roomInfo.pinned[k]); - let apps = order.map(wId => this.widgetMap.get(wId)).filter(Boolean); - apps = apps.slice(0, priorityWidget ? MAX_PINNED - 1 : MAX_PINNED); + const apps = order + .map(wId => Array.from(this.widgetMap.values()) + .find(w2 => w2.roomId === roomId && w2.id === wId)) + .filter(Boolean) + .slice(0, priorityWidget ? MAX_PINNED - 1 : MAX_PINNED); if (priorityWidget) { apps.push(priorityWidget); } + // Sanity check for https://github.com/vector-im/element-web/issues/15705 + // We union the app IDs the above generated with the roomInfo's known widgets to + // get a list of IDs which both exist. We then diff that against the generated app + // IDs above to ensure that all of the app IDs are captured by the union with the + // room - if we grabbed a widget that wasn't part of the roomInfo's list, it wouldn't + // be in the union and thus result in a diff. + const appIds = apps.map(a => widgetUid(a)); + const roomAppIds = roomInfo.widgets.map(a => widgetUid(a)); + const roomAppIdsUnion = arrayUnion(appIds, roomAppIds); + const missingSomeApps = arrayHasDiff(roomAppIdsUnion, appIds); + if (missingSomeApps) { + const diff = arrayDiff(roomAppIdsUnion, appIds); + console.warn( + `${roomId} appears to have a conflict for which widgets belong to it. ` + + `Widget UIDs are: `, [...diff.added, ...diff.removed], + ); + } + return apps; } From 3223b00028535c046af44ac9be4784028f864da5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 3 Dec 2020 11:15:55 +0000 Subject: [PATCH 06/20] Jump to home page when leaving a room so that you don't get thrown into a room you may be ignoring on purpose --- src/RoomListSorter.js | 31 ------------- src/components/structures/MatrixChat.tsx | 44 ++----------------- src/components/structures/RoomView.tsx | 4 +- .../views/dialogs/RoomSettingsDialog.js | 4 +- src/utils/membership.ts | 2 +- 5 files changed, 9 insertions(+), 76 deletions(-) delete mode 100644 src/RoomListSorter.js diff --git a/src/RoomListSorter.js b/src/RoomListSorter.js deleted file mode 100644 index 0ff37a6af2..0000000000 --- a/src/RoomListSorter.js +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright 2015, 2016 OpenMarket Ltd - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -'use strict'; - -function tsOfNewestEvent(room) { - if (room.timeline.length) { - return room.timeline[room.timeline.length - 1].getTs(); - } else { - return Number.MAX_SAFE_INTEGER; - } -} - -export function mostRecentActivityFirst(roomList) { - return roomList.sort(function(a, b) { - return tsOfNewestEvent(b) - tsOfNewestEvent(a); - }); -} diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 9fede15aa6..8d111e7c32 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -591,7 +591,7 @@ export default class MatrixChat extends React.PureComponent { MatrixClientPeg.get().leave(payload.room_id).then(() => { modal.close(); if (this.state.currentRoomId === payload.room_id) { - dis.dispatch({action: 'view_next_room'}); + dis.dispatch({action: 'view_home_page'}); } }, (err) => { modal.close(); @@ -620,9 +620,6 @@ export default class MatrixChat extends React.PureComponent { } break; } - case 'view_next_room': - this.viewNextRoom(1); - break; case Action.ViewUserSettings: { const tabPayload = payload as OpenToTabPayload; const UserSettingsDialog = sdk.getComponent("dialogs.UserSettingsDialog"); @@ -802,35 +799,6 @@ export default class MatrixChat extends React.PureComponent { this.notifyNewScreen('register'); } - // TODO: Move to RoomViewStore - private viewNextRoom(roomIndexDelta: number) { - const allRooms = RoomListSorter.mostRecentActivityFirst( - MatrixClientPeg.get().getRooms(), - ); - // If there are 0 rooms or 1 room, view the home page because otherwise - // if there are 0, we end up trying to index into an empty array, and - // if there is 1, we end up viewing the same room. - if (allRooms.length < 2) { - dis.dispatch({ - action: 'view_home_page', - }); - return; - } - let roomIndex = -1; - for (let i = 0; i < allRooms.length; ++i) { - if (allRooms[i].roomId === this.state.currentRoomId) { - roomIndex = i; - break; - } - } - roomIndex = (roomIndex + roomIndexDelta) % allRooms.length; - if (roomIndex < 0) roomIndex = allRooms.length - 1; - dis.dispatch({ - action: 'view_room', - room_id: allRooms[roomIndex].roomId, - }); - } - // switch view to the given room // // @param {Object} roomInfo Object containing data about the room to be joined @@ -1097,9 +1065,9 @@ export default class MatrixChat extends React.PureComponent { private forgetRoom(roomId: string) { MatrixClientPeg.get().forget(roomId).then(() => { - // Switch to another room view if we're currently viewing the historical room + // Switch to home page if we're currently viewing the forgotten room if (this.state.currentRoomId === roomId) { - dis.dispatch({ action: "view_next_room" }); + dis.dispatch({ action: "view_home_page" }); } }).catch((err) => { const errCode = err.errcode || _td("unknown error code"); @@ -1233,12 +1201,8 @@ export default class MatrixChat extends React.PureComponent { } else { if (MatrixClientPeg.get().isGuest()) { dis.dispatch({action: 'view_welcome_page'}); - } else if (getHomePageUrl(this.props.config)) { - dis.dispatch({action: 'view_home_page'}); } else { - this.firstSyncPromise.promise.then(() => { - dis.dispatch({action: 'view_next_room'}); - }); + dis.dispatch({action: 'view_home_page'}); } } } diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index f4f7c6ceec..adcb401ec1 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -1332,7 +1332,7 @@ export default class RoomView extends React.Component { rejecting: true, }); this.context.leave(this.state.roomId).then(() => { - dis.dispatch({ action: 'view_next_room' }); + dis.dispatch({ action: 'view_home_page' }); this.setState({ rejecting: false, }); @@ -1366,7 +1366,7 @@ export default class RoomView extends React.Component { await this.context.setIgnoredUsers(ignoredUsers); await this.context.leave(this.state.roomId); - dis.dispatch({ action: 'view_next_room' }); + dis.dispatch({ action: 'view_home_page' }); this.setState({ rejecting: false, }); diff --git a/src/components/views/dialogs/RoomSettingsDialog.js b/src/components/views/dialogs/RoomSettingsDialog.js index a43b284c42..9d9313f08f 100644 --- a/src/components/views/dialogs/RoomSettingsDialog.js +++ b/src/components/views/dialogs/RoomSettingsDialog.js @@ -53,9 +53,9 @@ export default class RoomSettingsDialog extends React.Component { } _onAction = (payload) => { - // When room changes below us, close the room settings + // When view changes below us, close the room settings // whilst the modal is open this can only be triggered when someone hits Leave Room - if (payload.action === 'view_next_room') { + if (payload.action === 'view_home_page') { this.props.onFinished(); } }; diff --git a/src/utils/membership.ts b/src/utils/membership.ts index 696bd57880..80f04dfe76 100644 --- a/src/utils/membership.ts +++ b/src/utils/membership.ts @@ -140,6 +140,6 @@ export async function leaveRoomBehaviour(roomId: string) { } if (RoomViewStore.getRoomId() === roomId) { - dis.dispatch({action: 'view_next_room'}); + dis.dispatch({action: 'view_home_page'}); } } From f432d4e3941a879d840996cf4f3f20e974ddd664 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 3 Dec 2020 11:31:14 +0000 Subject: [PATCH 07/20] delint --- src/components/structures/MatrixChat.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 8d111e7c32..17bb5031ab 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -34,7 +34,6 @@ import { DecryptionFailureTracker } from "../../DecryptionFailureTracker"; import { MatrixClientPeg, IMatrixClientCreds } from "../../MatrixClientPeg"; import PlatformPeg from "../../PlatformPeg"; import SdkConfig from "../../SdkConfig"; -import * as RoomListSorter from "../../RoomListSorter"; import dis from "../../dispatcher/dispatcher"; import Notifier from '../../Notifier'; @@ -48,7 +47,6 @@ import * as Lifecycle from '../../Lifecycle'; // LifecycleStore is not used but does listen to and dispatch actions import '../../stores/LifecycleStore'; import PageTypes from '../../PageTypes'; -import { getHomePageUrl } from '../../utils/pages'; import createRoom from "../../createRoom"; import {_t, _td, getCurrentLanguage} from '../../languageHandler'; From 1fda73522284f2eb08f240de853d6cceee795b85 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 3 Dec 2020 13:56:27 +0000 Subject: [PATCH 08/20] Rebrand various CI scripts and modules This replaces Riot with Element in various CI scripts, modules, parameters, etc. This _should_ be the last major rebranding pass (hopefully). Fixes https://github.com/vector-im/element-web/issues/14894 --- .eslintignore | 2 +- .eslintignore.errorfiles | 2 +- package.json | 2 +- scripts/ci/{riot-unit-tests.sh => app-tests.sh} | 6 +++--- scripts/ci/end-to-end-tests.sh | 14 +++++++------- scripts/ci/{layered-riot-web.sh => layered.sh} | 10 +++++----- test/end-to-end-tests/.gitignore | 2 +- test/end-to-end-tests/README.md | 11 +++++------ test/end-to-end-tests/Windows.md | 8 ++++---- test/end-to-end-tests/element/.gitignore | 2 ++ .../config-template/config.json | 2 +- .../{riot => element}/install-webserver.sh | 0 test/end-to-end-tests/element/install.sh | 16 ++++++++++++++++ test/end-to-end-tests/{riot => element}/start.sh | 10 +++++----- test/end-to-end-tests/{riot => element}/stop.sh | 6 +++--- .../{has_custom_riot.js => has-custom-app.js} | 8 ++++---- test/end-to-end-tests/riot/.gitignore | 2 -- test/end-to-end-tests/riot/install.sh | 16 ---------------- test/end-to-end-tests/run.sh | 14 +++++++------- test/end-to-end-tests/src/session.js | 12 ++++++------ test/end-to-end-tests/start.js | 6 +++--- .../config-templates/consent/homeserver.yaml | 6 +++--- 22 files changed, 78 insertions(+), 79 deletions(-) rename scripts/ci/{riot-unit-tests.sh => app-tests.sh} (56%) rename scripts/ci/{layered-riot-web.sh => layered.sh} (66%) create mode 100644 test/end-to-end-tests/element/.gitignore rename test/end-to-end-tests/{riot => element}/config-template/config.json (92%) rename test/end-to-end-tests/{riot => element}/install-webserver.sh (100%) create mode 100755 test/end-to-end-tests/element/install.sh rename test/end-to-end-tests/{riot => element}/start.sh (87%) rename test/end-to-end-tests/{riot => element}/stop.sh (79%) rename test/end-to-end-tests/{has_custom_riot.js => has-custom-app.js} (83%) delete mode 100644 test/end-to-end-tests/riot/.gitignore delete mode 100755 test/end-to-end-tests/riot/install.sh diff --git a/.eslintignore b/.eslintignore index c4f7298047..e453170087 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ src/component-index.js test/end-to-end-tests/node_modules/ -test/end-to-end-tests/riot/ +test/end-to-end-tests/element/ test/end-to-end-tests/synapse/ diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index db90d26ba7..1c0a3d1254 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -12,5 +12,5 @@ test/components/views/dialogs/InteractiveAuthDialog-test.js test/mock-clock.js src/component-index.js test/end-to-end-tests/node_modules/ -test/end-to-end-tests/riot/ +test/end-to-end-tests/element/ test/end-to-end-tests/synapse/ diff --git a/package.json b/package.json index f3b8104663..1e778f9875 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "lint:types": "tsc --noEmit --jsx react", "lint:style": "stylelint 'res/css/**/*.scss'", "test": "jest", - "test:e2e": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080" + "test:e2e": "./test/end-to-end-tests/run.sh --app-url http://localhost:8080" }, "dependencies": { "@babel/runtime": "^7.10.5", diff --git a/scripts/ci/riot-unit-tests.sh b/scripts/ci/app-tests.sh similarity index 56% rename from scripts/ci/riot-unit-tests.sh rename to scripts/ci/app-tests.sh index 337c0fe6c3..3ca4d8ec69 100755 --- a/scripts/ci/riot-unit-tests.sh +++ b/scripts/ci/app-tests.sh @@ -2,11 +2,11 @@ # # script which is run by the CI build (after `yarn test`). # -# clones riot-web develop and runs the tests against our version of react-sdk. +# clones element-web develop and runs the tests against our version of react-sdk. set -ev -scripts/ci/layered-riot-web.sh -cd ../riot-web +scripts/ci/layered.sh +cd ../element-web yarn build:genfiles # so the tests can run. Faster version of `build` yarn test diff --git a/scripts/ci/end-to-end-tests.sh b/scripts/ci/end-to-end-tests.sh index 7a62c03b12..65cd3f6c21 100755 --- a/scripts/ci/end-to-end-tests.sh +++ b/scripts/ci/end-to-end-tests.sh @@ -2,7 +2,7 @@ # # script which is run by the CI build (after `yarn test`). # -# clones riot-web develop and runs the tests against our version of react-sdk. +# clones element-web develop and runs the tests against our version of react-sdk. set -ev @@ -14,20 +14,20 @@ handle_error() { trap 'handle_error' ERR echo "--- Building Element" -scripts/ci/layered-riot-web.sh -cd ../riot-web -riot_web_dir=`pwd` +scripts/ci/layered.sh +cd ../element-web +element_web_dir=`pwd` CI_PACKAGE=true yarn build cd ../matrix-react-sdk # run end to end tests pushd test/end-to-end-tests -ln -s $riot_web_dir riot/riot-web +ln -s $element_web_dir element/element-web # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh # CHROME_PATH=$(which google-chrome-stable) ./run.sh echo "--- Install synapse & other dependencies" ./install.sh -# install static webserver to server symlinked local copy of riot -./riot/install-webserver.sh +# install static webserver to server symlinked local copy of element +./element/install-webserver.sh rm -r logs || true mkdir logs echo "+++ Running end-to-end tests" diff --git a/scripts/ci/layered-riot-web.sh b/scripts/ci/layered.sh similarity index 66% rename from scripts/ci/layered-riot-web.sh rename to scripts/ci/layered.sh index f58794b451..51d285aff6 100755 --- a/scripts/ci/layered-riot-web.sh +++ b/scripts/ci/layered.sh @@ -1,8 +1,8 @@ #!/bin/bash -# Creates an environment similar to one that riot-web would expect for +# Creates an environment similar to one that element-web would expect for # development. This means going one directory up (and assuming we're in -# a directory like /workdir/matrix-react-sdk) and putting riot-web and +# a directory like /workdir/matrix-react-sdk) and putting element-web and # the js-sdk there. cd ../ # Assume we're at something like /workdir/matrix-react-sdk @@ -21,9 +21,9 @@ yarn link yarn install popd -# Finally, set up riot-web -matrix-react-sdk/scripts/fetchdep.sh vector-im riot-web -pushd riot-web +# Finally, set up element-web +matrix-react-sdk/scripts/fetchdep.sh vector-im element-web +pushd element-web yarn link matrix-js-sdk yarn link matrix-react-sdk yarn install diff --git a/test/end-to-end-tests/.gitignore b/test/end-to-end-tests/.gitignore index afca1ddcb3..61f9012393 100644 --- a/test/end-to-end-tests/.gitignore +++ b/test/end-to-end-tests/.gitignore @@ -1,3 +1,3 @@ node_modules *.png -riot/env +element/env diff --git a/test/end-to-end-tests/README.md b/test/end-to-end-tests/README.md index 8794ef6c9b..b173fb86c2 100644 --- a/test/end-to-end-tests/README.md +++ b/test/end-to-end-tests/README.md @@ -5,9 +5,9 @@ This directory contains tests for matrix-react-sdk. The tests fire up a headless ## Setup Run `./install.sh`. This will: - - install Synapse, fetches the master branch at the moment. If anything fails here, please refer to the Synapse README to see if you're missing one of the prerequisites. - - install Riot, this fetches the master branch at the moment. - - install dependencies (will download copy of chrome) + - install Synapse, fetches the develop branch at the moment. If anything fails here, please refer to the Synapse README to see if you're missing one of the prerequisites. + - install Element Web, this fetches the develop branch at the moment. + - install dependencies (will download copy of Chrome) ## Running the tests @@ -15,7 +15,7 @@ Run tests with `./run.sh`. ### Debug tests locally. -`./run.sh` will run the tests against the Riot copy present in `riot/riot-web` served by a static Python HTTP server. You can symlink your `riot-web` develop copy here but that doesn't work well with Webpack recompiling. You can run the test runner directly and specify parameters to get more insight into a failure or run the tests against your local Webpack server. +`./run.sh` will run the tests against the Element copy present in `element/element-web` served by a static Python HTTP server. You can symlink your `element-web` develop copy here but that doesn't work well with Webpack recompiling. You can run the test runner directly and specify parameters to get more insight into a failure or run the tests against your local Webpack server. ``` ./synapse/stop.sh && \ @@ -26,8 +26,7 @@ It's important to always stop and start Synapse before each run of the tests to start.js accepts these parameters (and more, see `node start.js --help`) that can help running the tests locally: - - `--riot-url ` don't use the Riot copy and static server provided by the tests, but use a running server like the Webpack watch server to run the tests against. Make sure to have the following local config: - - `welcomeUserId` disabled as the tests assume there is no riot-bot currently. + - `--app-url ` don't use the Element Web copy and static server provided by the tests, but use a running server like the Webpack watch server to run the tests against. - `--slow-mo` type at a human speed, useful with `--windowed`. - `--throttle-cpu ` throttle cpu in the browser by the given factor. Useful to reproduce failures because of insufficient timeouts happening on the slower CI server. - `--windowed` run the tests in an actual browser window Try to limit interacting with the windows while the tests are running. Hovering over the window tends to fail the tests, dragging the title bar should be fine though. diff --git a/test/end-to-end-tests/Windows.md b/test/end-to-end-tests/Windows.md index 39b06a9a62..f6ea87d0af 100644 --- a/test/end-to-end-tests/Windows.md +++ b/test/end-to-end-tests/Windows.md @@ -5,14 +5,14 @@ and start following these steps to get going: 1. Navigate to your working directory (`cd /mnt/c/users/travisr/whatever/matrix-react-sdk` for example). 2. Run `sudo apt-get install unzip python3 virtualenv dos2unix` -3. Run `dos2unix ./test/end-to-end-tests/*.sh ./test/end-to-end-tests/synapse/*.sh ./test/end-to-end-tests/riot/*.sh` +3. Run `dos2unix ./test/end-to-end-tests/*.sh ./test/end-to-end-tests/synapse/*.sh ./test/end-to-end-tests/element/*.sh` 4. Install NodeJS for ubuntu: ```bash curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get update sudo apt-get install nodejs ``` -5. Start Riot on Windows through `yarn start` +5. Start Element on Windows through `yarn start` 6. While that builds... Run: ```bash sudo apt-get install x11-apps @@ -25,11 +25,11 @@ and start following these steps to get going: cd ./test/end-to-end-tests ./synapse/install.sh ./install.sh - ./run.sh --riot-url http://localhost:8080 --no-sandbox + ./run.sh --app-url http://localhost:8080 --no-sandbox ``` Note that using `yarn test:e2e` probably won't work for you. You might also have to use the config.json from the -`riot/config-template` directory in order to actually succeed at the tests. +`element/config-template` directory in order to actually succeed at the tests. Also note that you'll have to use `--no-sandbox` otherwise Chrome will complain that there's no sandbox available. You could probably fix this with enough effort, or you could run a headless Chrome in the WSL container without a sandbox. diff --git a/test/end-to-end-tests/element/.gitignore b/test/end-to-end-tests/element/.gitignore new file mode 100644 index 0000000000..57fac2072f --- /dev/null +++ b/test/end-to-end-tests/element/.gitignore @@ -0,0 +1,2 @@ +element-web +element.pid diff --git a/test/end-to-end-tests/riot/config-template/config.json b/test/end-to-end-tests/element/config-template/config.json similarity index 92% rename from test/end-to-end-tests/riot/config-template/config.json rename to test/end-to-end-tests/element/config-template/config.json index b647d0bec8..b90fefc2cb 100644 --- a/test/end-to-end-tests/riot/config-template/config.json +++ b/test/end-to-end-tests/element/config-template/config.json @@ -8,7 +8,7 @@ "brand": "Element", "integrations_ui_url": "https://scalar.vector.im/", "integrations_rest_url": "https://scalar.vector.im/api", - "bug_report_endpoint_url": "https://riot.im/bugreports/submit", + "bug_report_endpoint_url": "https://element.io/bugreports/submit", "showLabsSettings": true, "default_federate": true, "welcomePageUrl": "home.html", diff --git a/test/end-to-end-tests/riot/install-webserver.sh b/test/end-to-end-tests/element/install-webserver.sh similarity index 100% rename from test/end-to-end-tests/riot/install-webserver.sh rename to test/end-to-end-tests/element/install-webserver.sh diff --git a/test/end-to-end-tests/element/install.sh b/test/end-to-end-tests/element/install.sh new file mode 100755 index 0000000000..e38f795df1 --- /dev/null +++ b/test/end-to-end-tests/element/install.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e +ELEMENT_BRANCH=develop + +if [ -d $BASE_DIR/element-web ]; then + echo "Element is already installed" + exit +fi + +curl -L https://github.com/vector-im/element-web/archive/${ELEMENT_BRANCH}.zip --output element.zip +unzip -q element.zip +rm element.zip +mv element-web-${ELEMENT_BRANCH} element-web +cd element-web +yarn install +yarn run build diff --git a/test/end-to-end-tests/riot/start.sh b/test/end-to-end-tests/element/start.sh similarity index 87% rename from test/end-to-end-tests/riot/start.sh rename to test/end-to-end-tests/element/start.sh index be226ed257..b344f91a19 100755 --- a/test/end-to-end-tests/riot/start.sh +++ b/test/end-to-end-tests/element/start.sh @@ -3,7 +3,7 @@ set -e PORT=5000 BASE_DIR=$(cd $(dirname $0) && pwd) -PIDFILE=$BASE_DIR/riot.pid +PIDFILE=$BASE_DIR/element.pid CONFIG_BACKUP=config.e2etests_backup.json if [ -f $PIDFILE ]; then @@ -11,8 +11,8 @@ if [ -f $PIDFILE ]; then fi cd $BASE_DIR/ -echo -n "starting riot on http://localhost:$PORT ... " -pushd riot-web/webapp/ > /dev/null +echo -n "Starting Element on http://localhost:$PORT ... " +pushd element-web/webapp/ > /dev/null # backup config file before we copy template if [ -f config.json ]; then @@ -34,7 +34,7 @@ LOGFILE=$(mktemp) # NOT expected SIGTERM (128 + 15) # from stop.sh? if [ $RESULT -ne 143 ]; then - echo "failed" + echo "Failed" cat $LOGFILE rm $PIDFILE 2> /dev/null fi @@ -49,6 +49,6 @@ sleep 0.5 & wait -n; RESULT=$? # return exit code of first child to exit if [ $RESULT -eq 0 ]; then - echo "running" + echo "Running" fi exit $RESULT diff --git a/test/end-to-end-tests/riot/stop.sh b/test/end-to-end-tests/element/stop.sh similarity index 79% rename from test/end-to-end-tests/riot/stop.sh rename to test/end-to-end-tests/element/stop.sh index eb99fa11cc..e39f0077eb 100755 --- a/test/end-to-end-tests/riot/stop.sh +++ b/test/end-to-end-tests/element/stop.sh @@ -2,19 +2,19 @@ set -e BASE_DIR=$(cd $(dirname $0) && pwd) -PIDFILE=riot.pid +PIDFILE=element.pid CONFIG_BACKUP=config.e2etests_backup.json cd $BASE_DIR if [ -f $PIDFILE ]; then - echo "stopping riot server ..." + echo "Stopping Element server ..." PID=$(cat $PIDFILE) rm $PIDFILE kill $PID # revert config file - cd riot-web/webapp + cd element-web/webapp rm config.json if [ -f $CONFIG_BACKUP ]; then mv $CONFIG_BACKUP config.json diff --git a/test/end-to-end-tests/has_custom_riot.js b/test/end-to-end-tests/has-custom-app.js similarity index 83% rename from test/end-to-end-tests/has_custom_riot.js rename to test/end-to-end-tests/has-custom-app.js index 95f32d8ad0..00184088fd 100644 --- a/test/end-to-end-tests/has_custom_riot.js +++ b/test/end-to-end-tests/has-custom-app.js @@ -15,10 +15,10 @@ limitations under the License. */ // used from run.sh as getopts doesn't support long parameters -const idx = process.argv.indexOf("--riot-url"); -let hasRiotUrl = false; +const idx = process.argv.indexOf("--app-url"); +let hasAppUrl = false; if (idx !== -1) { const value = process.argv[idx + 1]; - hasRiotUrl = !!value; + hasAppUrl = !!value; } -process.stdout.write(hasRiotUrl ? "1" : "0" ); +process.stdout.write(hasAppUrl ? "1" : "0" ); diff --git a/test/end-to-end-tests/riot/.gitignore b/test/end-to-end-tests/riot/.gitignore deleted file mode 100644 index 0f07d8e498..0000000000 --- a/test/end-to-end-tests/riot/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -riot-web -riot.pid \ No newline at end of file diff --git a/test/end-to-end-tests/riot/install.sh b/test/end-to-end-tests/riot/install.sh deleted file mode 100755 index f66ab3224e..0000000000 --- a/test/end-to-end-tests/riot/install.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -e -RIOT_BRANCH=develop - -if [ -d $BASE_DIR/riot-web ]; then - echo "riot is already installed" - exit -fi - -curl -L https://github.com/vector-im/riot-web/archive/${RIOT_BRANCH}.zip --output riot.zip -unzip -q riot.zip -rm riot.zip -mv riot-web-${RIOT_BRANCH} riot-web -cd riot-web -yarn install -yarn run build diff --git a/test/end-to-end-tests/run.sh b/test/end-to-end-tests/run.sh index b9d589eed9..4421bddc34 100755 --- a/test/end-to-end-tests/run.sh +++ b/test/end-to-end-tests/run.sh @@ -9,16 +9,16 @@ echo "Please first run $BASE_DIR/install.sh" exit 1 fi -has_custom_riot=$(node has_custom_riot.js $@) +has_custom_app=$(node has-custom-app.js $@) -if [ ! -d "riot/riot-web" ] && [ $has_custom_riot -ne "1" ]; then - echo "Please provide an instance of riot to test against by passing --riot-url or running $BASE_DIR/riot/install.sh" +if [ ! -d "element/element-web" ] && [ $has_custom_app -ne "1" ]; then + echo "Please provide an instance of Element to test against by passing --element-url or running $BASE_DIR/element/install.sh" exit 1 fi stop_servers() { - if [ $has_custom_riot -ne "1" ]; then - ./riot/stop.sh + if [ $has_custom_app -ne "1" ]; then + ./element/stop.sh fi ./synapse/stop.sh } @@ -32,8 +32,8 @@ handle_error() { trap 'handle_error' ERR ./synapse/start.sh -if [ $has_custom_riot -ne "1" ]; then - ./riot/start.sh +if [ $has_custom_app -ne "1" ]; then + ./element/start.sh fi node start.js $@ stop_servers diff --git a/test/end-to-end-tests/src/session.js b/test/end-to-end-tests/src/session.js index 907ee2fb8e..433baa5e48 100644 --- a/test/end-to-end-tests/src/session.js +++ b/test/end-to-end-tests/src/session.js @@ -22,12 +22,12 @@ const {delay} = require('./util'); const DEFAULT_TIMEOUT = 20000; -module.exports = class RiotSession { - constructor(browser, page, username, riotserver, hsUrl) { +module.exports = class ElementSession { + constructor(browser, page, username, elementServer, hsUrl) { this.browser = browser; this.page = page; this.hsUrl = hsUrl; - this.riotserver = riotserver; + this.elementServer = elementServer; this.username = username; this.consoleLog = new LogBuffer(page, "console", (msg) => `${msg.text()}\n`); this.networkLog = new LogBuffer(page, "requestfinished", async (req) => { @@ -38,7 +38,7 @@ module.exports = class RiotSession { this.log = new Logger(this.username); } - static async create(username, puppeteerOptions, riotserver, hsUrl, throttleCpuFactor = 1) { + static async create(username, puppeteerOptions, elementServer, hsUrl, throttleCpuFactor = 1) { const browser = await puppeteer.launch(puppeteerOptions); const page = await browser.newPage(); await page.setViewport({ @@ -50,7 +50,7 @@ module.exports = class RiotSession { console.log("throttling cpu by a factor of", throttleCpuFactor); await client.send('Emulation.setCPUThrottlingRate', { rate: throttleCpuFactor }); } - return new RiotSession(browser, page, username, riotserver, hsUrl); + return new ElementSession(browser, page, username, elementServer, hsUrl); } async tryGetInnertext(selector) { @@ -194,7 +194,7 @@ module.exports = class RiotSession { } url(path) { - return this.riotserver + path; + return this.elementServer + path; } delay(ms) { diff --git a/test/end-to-end-tests/start.js b/test/end-to-end-tests/start.js index 6c80608903..234d60da9f 100644 --- a/test/end-to-end-tests/start.js +++ b/test/end-to-end-tests/start.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -const RiotSession = require('./src/session'); +const ElementSession = require('./src/session'); const scenario = require('./src/scenario'); const RestSessionCreator = require('./src/rest/creator'); const fs = require("fs"); @@ -22,7 +22,7 @@ const fs = require("fs"); const program = require('commander'); program .option('--no-logs', "don't output logs, document html on error", false) - .option('--riot-url [url]', "riot url to test", "http://localhost:5000") + .option('--app-url [url]', "url to test", "http://localhost:5000") .option('--windowed', "dont run tests headless", false) .option('--slow-mo', "type at a human speed", false) .option('--dev-tools', "open chrome devtools in browser window", false) @@ -57,7 +57,7 @@ async function runTests() { ); async function createSession(username) { - const session = await RiotSession.create(username, options, program.riotUrl, hsUrl, program.throttleCpu); + const session = await ElementSession.create(username, options, program.appUrl, hsUrl, program.throttleCpu); sessions.push(session); return session; } diff --git a/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml b/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml index 536c017b9e..deb750666f 100644 --- a/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml +++ b/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml @@ -875,8 +875,8 @@ password_config: # Enable sending emails for notification events -# Defining a custom URL for Riot is only needed if email notifications -# should contain links to a self-hosted installation of Riot; when set +# Defining a custom URL for Element is only needed if email notifications +# should contain links to a self-hosted installation of Element; when set # the "app_name" setting is ignored. # # If your SMTP server requires authentication, the optional smtp_user & @@ -897,7 +897,7 @@ email: notif_template_html: notif_mail.html notif_template_text: notif_mail.txt notif_for_new_users: True - riot_base_url: "http://localhost/riot" + client_base_url: "http://localhost/element" #password_providers: From cdc57cf1f56a2c8a5cd91266090bd25bd7ab336b Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 3 Dec 2020 13:58:25 +0000 Subject: [PATCH 09/20] Add temporary symlink for pipeline --- scripts/ci/riot-unit-tests.sh | 1 + 1 file changed, 1 insertion(+) create mode 120000 scripts/ci/riot-unit-tests.sh diff --git a/scripts/ci/riot-unit-tests.sh b/scripts/ci/riot-unit-tests.sh new file mode 120000 index 0000000000..199dfb58fd --- /dev/null +++ b/scripts/ci/riot-unit-tests.sh @@ -0,0 +1 @@ +app-tests.sh \ No newline at end of file From a6e69db8f51e97ec22881a302344b9dbd33bcec6 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 3 Dec 2020 14:56:24 +0000 Subject: [PATCH 10/20] Rebrand E2E test Docker image --- scripts/ci/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/Dockerfile b/scripts/ci/Dockerfile index c153d11cc7..5351291f29 100644 --- a/scripts/ci/Dockerfile +++ b/scripts/ci/Dockerfile @@ -1,7 +1,7 @@ # Update on docker hub with the following commands in the directory of this file: -# docker build -t matrixdotorg/riotweb-ci-e2etests-env:latest . +# docker build -t vectorim/element-web-ci-e2etests-env:latest . # docker log -# docker push matrixdotorg/riotweb-ci-e2etests-env:latest +# docker push vectorim/element-web-ci-e2etests-env:latest FROM node:10 RUN apt-get update RUN apt-get -y install build-essential python3-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev uuid-runtime From 883d5d96a7ea85358c11336d4be0a2aa499d5681 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 20 Nov 2020 17:55:48 +0000 Subject: [PATCH 11/20] Nest other layers inside on automation This changes the nesting style because some CI / CD systems do not allow moving to a directory above the checkout for the primary repo (`react-sdk` in this case). Part of https://github.com/vector-im/element-web/issues/12624 --- scripts/ci/app-tests.sh | 2 +- scripts/ci/end-to-end-tests.sh | 4 ++-- scripts/ci/layered.sh | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/ci/app-tests.sh b/scripts/ci/app-tests.sh index 3ca4d8ec69..97e54dce66 100755 --- a/scripts/ci/app-tests.sh +++ b/scripts/ci/app-tests.sh @@ -7,6 +7,6 @@ set -ev scripts/ci/layered.sh -cd ../element-web +cd element-web yarn build:genfiles # so the tests can run. Faster version of `build` yarn test diff --git a/scripts/ci/end-to-end-tests.sh b/scripts/ci/end-to-end-tests.sh index 65cd3f6c21..edb8870d8e 100755 --- a/scripts/ci/end-to-end-tests.sh +++ b/scripts/ci/end-to-end-tests.sh @@ -15,10 +15,10 @@ trap 'handle_error' ERR echo "--- Building Element" scripts/ci/layered.sh -cd ../element-web +cd element-web element_web_dir=`pwd` CI_PACKAGE=true yarn build -cd ../matrix-react-sdk +cd .. # run end to end tests pushd test/end-to-end-tests ln -s $element_web_dir element/element-web diff --git a/scripts/ci/layered.sh b/scripts/ci/layered.sh index 51d285aff6..306f9c9974 100755 --- a/scripts/ci/layered.sh +++ b/scripts/ci/layered.sh @@ -1,28 +1,28 @@ #!/bin/bash -# Creates an environment similar to one that element-web would expect for -# development. This means going one directory up (and assuming we're in -# a directory like /workdir/matrix-react-sdk) and putting element-web and -# the js-sdk there. +# Creates a layered environment with the full repo for the app and SDKs cloned +# and linked. -cd ../ # Assume we're at something like /workdir/matrix-react-sdk +# Note that this style is different from the recommended developer setup: this +# file nests js-sdk and element-web inside react-sdk, while the local +# development setup places them all at the same level. We are nesting them here +# because some CI systems do not allow moving to a directory above the checkout +# for the primary repo (react-sdk in this case). # Set up the js-sdk first -matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-js-sdk +scripts/fetchdep.sh matrix-org matrix-js-sdk pushd matrix-js-sdk yarn link yarn install popd # Now set up the react-sdk -pushd matrix-react-sdk yarn link matrix-js-sdk yarn link yarn install -popd # Finally, set up element-web -matrix-react-sdk/scripts/fetchdep.sh vector-im element-web +scripts/fetchdep.sh vector-im element-web pushd element-web yarn link matrix-js-sdk yarn link matrix-react-sdk From c853085e2930f9761aceffa62e8643703d08a4cd Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 3 Dec 2020 18:40:33 +0000 Subject: [PATCH 12/20] Add support for Netlify to fetchdep script and remove support for Jenkins --- scripts/fetchdep.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/fetchdep.sh b/scripts/fetchdep.sh index 0142305797..850eef25ec 100755 --- a/scripts/fetchdep.sh +++ b/scripts/fetchdep.sh @@ -34,7 +34,7 @@ elif [[ "${#BUILDKITE_BRANCH_ARRAY[@]}" == "2" ]]; then fi # Try the target branch of the push or PR. clone $deforg $defrepo $BUILDKITE_PULL_REQUEST_BASE_BRANCH -# Try the current branch from Jenkins. -clone $deforg $defrepo `"echo $GIT_BRANCH" | sed -e 's/^origin\///'` +# Try HEAD which is the branch name in Netlify (not BRANCH which is pull/xxxx/head for PR builds) +clone $deforg $defrepo $HEAD # Use the default branch as the last resort. clone $deforg $defrepo $defbranch From c63c8540f1dda6ce1a4ffed0ba9725af2359eea5 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 4 Dec 2020 11:05:01 +0000 Subject: [PATCH 13/20] Remove old app test script path Now that https://github.com/matrix-org/pipelines/pull/112 has merged, we no longer need to support this old path for launching app-level tests. --- scripts/ci/riot-unit-tests.sh | 1 - 1 file changed, 1 deletion(-) delete mode 120000 scripts/ci/riot-unit-tests.sh diff --git a/scripts/ci/riot-unit-tests.sh b/scripts/ci/riot-unit-tests.sh deleted file mode 120000 index 199dfb58fd..0000000000 --- a/scripts/ci/riot-unit-tests.sh +++ /dev/null @@ -1 +0,0 @@ -app-tests.sh \ No newline at end of file From 58eaccbba823a449ec2eb5cb7736155b0ab917b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2020 17:35:40 +0000 Subject: [PATCH 14/20] Bump highlight.js from 10.1.2 to 10.4.1 Bumps [highlight.js](https://github.com/highlightjs/highlight.js) from 10.1.2 to 10.4.1. - [Release notes](https://github.com/highlightjs/highlight.js/releases) - [Changelog](https://github.com/highlightjs/highlight.js/blob/master/CHANGES.md) - [Commits](https://github.com/highlightjs/highlight.js/compare/10.1.2...10.4.1) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index c06494d319..e33e784c93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4842,9 +4842,9 @@ has@^1.0.1, has@^1.0.3: function-bind "^1.1.1" highlight.js@^10.1.2: - version "10.1.2" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.1.2.tgz#c20db951ba1c22c055010648dfffd7b2a968e00c" - integrity sha512-Q39v/Mn5mfBlMff9r+zzA+gWxRsCRKwEMvYTiisLr/XUiFI/4puWt0Ojdko3R3JCNWGdOWaA5g/Yxqa23kC5AA== + version "10.4.1" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.4.1.tgz#d48fbcf4a9971c4361b3f95f302747afe19dbad0" + integrity sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg== hoist-non-react-statics@^3.3.0: version "3.3.2" From a85648413932281b830a71d3382cc9cb89732cfe Mon Sep 17 00:00:00 2001 From: Lukas Date: Sun, 6 Dec 2020 10:32:52 +0100 Subject: [PATCH 15/20] Fix typos in some strings This commit fixes some typos that I've stumbled upon. --- src/CallHandler.tsx | 4 ++-- src/components/views/dialogs/ServerPickerDialog.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index b5f696008d..2c30c51041 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -393,14 +393,14 @@ export default class CallHandler { title = _t("Unable to access microphone"); description =
{_t( - "Call failed because no microphone could not be accessed. " + + "Call failed because microphone could not be accessed. " + "Check that a microphone is plugged in and set up correctly.", )}
; } else if (call.type === CallType.Video) { title = _t("Unable to access webcam / microphone"); description =
- {_t("Call failed because no webcam or microphone could not be accessed. Check that:")} + {_t("Call failed because webcam or microphone could not be accessed. Check that:")}
  • {_t("A microphone and webcam are plugged in and set up correctly")}
  • {_t("Permission is granted to use the webcam")}
  • diff --git a/src/components/views/dialogs/ServerPickerDialog.tsx b/src/components/views/dialogs/ServerPickerDialog.tsx index 9eb819c98e..f528872587 100644 --- a/src/components/views/dialogs/ServerPickerDialog.tsx +++ b/src/components/views/dialogs/ServerPickerDialog.tsx @@ -153,7 +153,7 @@ export default class ServerPickerDialog extends React.PureComponent

    - {_t("We call the places you where you can host your account ‘homeservers’.")} {text} + {_t("We call the places where you can host your account ‘homeservers’.")} {text}

    Date: Mon, 7 Dec 2020 12:13:04 +0000 Subject: [PATCH 16/20] Upgrade matrix-js-sdk to 9.3.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7eff8cf388..084fdfa289 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "katex": "^0.12.0", "linkifyjs": "^2.1.9", "lodash": "^4.17.19", - "matrix-js-sdk": "9.3.0-rc.1", + "matrix-js-sdk": "9.3.0", "matrix-widget-api": "^0.1.0-beta.10", "minimist": "^1.2.5", "pako": "^1.0.11", diff --git a/yarn.lock b/yarn.lock index 2a49110d58..7cc852cdf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6512,10 +6512,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.3.0-rc.1: - version "9.3.0-rc.1" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.3.0-rc.1.tgz#d6ad2d9a5e0c539c6aec9e587a6dd2b5aa8bf2f6" - integrity sha512-H20QLwsgzBIO0Lp75CYBlw4QTOHT98vCESNZrnjIsu8FlFqsXIhdTa5C8BIYsNLex5luufxdp2an5BQtJEuAUQ== +matrix-js-sdk@9.3.0: + version "9.3.0" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.3.0.tgz#e5fa3f6cb5a56e5c5386ecf3110dc35072170dbb" + integrity sha512-rzvYJS5mMP42iQVfGokX8DgmJpTUH+k15vATyB5JyBq/3r/kP22tN78RgoNxYzrIP/R4rB4OHUFNtgGzBH2u8g== dependencies: "@babel/runtime" "^7.12.5" another-json "^0.2.0" From ae835fb8a9585326f718d5494f288cb0f597256f Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 7 Dec 2020 12:31:07 +0000 Subject: [PATCH 17/20] Prepare changelog for v3.10.0 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa0612695..151888a17e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [3.10.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.10.0) (2020-12-07) +===================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.10.0-rc.1...v3.10.0) + + * Upgrade to JS SDK 9.3.0 + Changes in [3.10.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.10.0-rc.1) (2020-12-02) =============================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.9.0...v3.10.0-rc.1) From fefe84d1015a8a6713165f627024590f6e34163f Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 7 Dec 2020 12:31:08 +0000 Subject: [PATCH 18/20] v3.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 084fdfa289..a318618ae8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "3.10.0-rc.1", + "version": "3.10.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 7d416045694ff85813ffc5d032edf7fcf6a64b13 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 7 Dec 2020 12:33:18 +0000 Subject: [PATCH 19/20] 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 8621dd2535..d4a2c568d5 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "katex": "^0.12.0", "linkifyjs": "^2.1.9", "lodash": "^4.17.19", - "matrix-js-sdk": "9.3.0", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "matrix-widget-api": "^0.1.0-beta.10", "minimist": "^1.2.5", "pako": "^1.0.11", diff --git a/yarn.lock b/yarn.lock index 7cc852cdf7..73ba9563d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6512,10 +6512,9 @@ 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.3.0: +"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "9.3.0" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.3.0.tgz#e5fa3f6cb5a56e5c5386ecf3110dc35072170dbb" - integrity sha512-rzvYJS5mMP42iQVfGokX8DgmJpTUH+k15vATyB5JyBq/3r/kP22tN78RgoNxYzrIP/R4rB4OHUFNtgGzBH2u8g== + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/ff6612f9d0aa1a7c08b65a0b41c5ab997506016f" dependencies: "@babel/runtime" "^7.12.5" another-json "^0.2.0" From 9bb04a857b6c963c2d55af44cd0183dd165d78a2 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 7 Dec 2020 15:21:31 +0100 Subject: [PATCH 20/20] Add generated i18n json --- src/i18n/strings/en_EN.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index a42bd5708f..8ddda3eff6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -47,9 +47,9 @@ "Try using turn.matrix.org": "Try using turn.matrix.org", "OK": "OK", "Unable to access microphone": "Unable to access microphone", - "Call failed because no microphone could not be accessed. Check that a microphone is plugged in and set up correctly.": "Call failed because no microphone could not be accessed. Check that a microphone is plugged in and set up correctly.", + "Call failed because microphone could not be accessed. Check that a microphone is plugged in and set up correctly.": "Call failed because microphone could not be accessed. Check that a microphone is plugged in and set up correctly.", "Unable to access webcam / microphone": "Unable to access webcam / microphone", - "Call failed because no webcam or microphone could not be accessed. Check that:": "Call failed because no webcam or microphone could not be accessed. Check that:", + "Call failed because webcam or microphone could not be accessed. Check that:": "Call failed because webcam or microphone could not be accessed. Check that:", "A microphone and webcam are plugged in and set up correctly": "A microphone and webcam are plugged in and set up correctly", "Permission is granted to use the webcam": "Permission is granted to use the webcam", "No other application is using the webcam": "No other application is using the webcam", @@ -2160,7 +2160,7 @@ "Specify a homeserver": "Specify a homeserver", "Matrix.org is the biggest public homeserver in the world, so it’s a good place for many.": "Matrix.org is the biggest public homeserver in the world, so it’s a good place for many.", "Sign into your homeserver": "Sign into your homeserver", - "We call the places you where you can host your account ‘homeservers’.": "We call the places you where you can host your account ‘homeservers’.", + "We call the places where you can host your account ‘homeservers’.": "We call the places where you can host your account ‘homeservers’.", "Other homeserver": "Other homeserver", "Use your preferred Matrix homeserver if you have one, or host your own.": "Use your preferred Matrix homeserver if you have one, or host your own.", "Learn more": "Learn more",