From b27f1fa6db112bb6da4bc3e562fb4782fb7a0f88 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 21 May 2020 18:06:36 +0100 Subject: [PATCH 01/12] Convert BasePlatform and BaseEventIndexManager to Typescript Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/{BasePlatform.js => BasePlatform.ts} | 55 ++++++++----------- ...dexManager.js => BaseEventIndexManager.ts} | 12 ++-- 2 files changed, 28 insertions(+), 39 deletions(-) rename src/{BasePlatform.js => BasePlatform.ts} (79%) rename src/indexing/{BaseEventIndexManager.js => BaseEventIndexManager.ts} (97%) diff --git a/src/BasePlatform.js b/src/BasePlatform.ts similarity index 79% rename from src/BasePlatform.js rename to src/BasePlatform.ts index e3cbc4dcf0..3f11f25d62 100644 --- a/src/BasePlatform.js +++ b/src/BasePlatform.ts @@ -1,5 +1,3 @@ -// @flow - /* Copyright 2016 Aviral Dasgupta Copyright 2016 OpenMarket Ltd @@ -19,9 +17,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {MatrixClient} from "matrix-js-sdk"; +import {MatrixClient} from "matrix-js-sdk/src/client"; import dis from './dispatcher/dispatcher'; import BaseEventIndexManager from './indexing/BaseEventIndexManager'; +import {ActionPayload} from "./dispatcher/payloads"; /** * Base class for classes that provide platform-specific functionality @@ -29,27 +28,25 @@ import BaseEventIndexManager from './indexing/BaseEventIndexManager'; * * Instances of this class are provided by the application. */ -export default class BasePlatform { - constructor() { - this.notificationCount = 0; - this.errorDidOccur = false; +export default abstract class BasePlatform { + protected notificationCount: number = 0; + protected errorDidOccur: boolean = false; - dis.register(this._onAction.bind(this)); + constructor() { + dis.register(this.onAction); } - _onAction(payload: Object) { + protected onAction = (payload: ActionPayload) => { switch (payload.action) { case 'on_client_not_viable': case 'on_logged_out': this.setNotificationCount(0); break; } - } + }; // Used primarily for Analytics - getHumanReadableName(): string { - return 'Base Platform'; - } + abstract getHumanReadableName(): string; setNotificationCount(count: number) { this.notificationCount = count; @@ -84,22 +81,16 @@ export default class BasePlatform { * that is 'granted' if the user allowed the request or * 'denied' otherwise. */ - requestNotificationPermission(): Promise { - } + abstract requestNotificationPermission(): Promise; - displayNotification(title: string, msg: string, avatarUrl: string, room: Object) { - } + abstract displayNotification(title: string, msg: string, avatarUrl: string, room: Object); - loudNotification(ev: Event, room: Object) { - } + abstract loudNotification(ev: Event, room: Object); /** - * Returns a promise that resolves to a string representing - * the current version of the application. + * Returns a promise that resolves to a string representing the current version of the application. */ - getAppVersion(): Promise { - throw new Error("getAppVersion not implemented!"); - } + abstract getAppVersion(): Promise; /* * If it's not expected that capturing the screen will work @@ -114,20 +105,18 @@ export default class BasePlatform { * Restarts the application, without neccessarily reloading * any application code */ - reload() { - throw new Error("reload not implemented!"); - } + abstract reload(); supportsAutoLaunch(): boolean { return false; } // XXX: Surely this should be a setting like any other? - async getAutoLaunchEnabled(): boolean { + async getAutoLaunchEnabled(): Promise { return false; } - async setAutoLaunchEnabled(enabled: boolean): void { + async setAutoLaunchEnabled(enabled: boolean): Promise { throw new Error("Unimplemented"); } @@ -135,11 +124,11 @@ export default class BasePlatform { return false; } - async getAutoHideMenuBarEnabled(): boolean { + async getAutoHideMenuBarEnabled(): Promise { return false; } - async setAutoHideMenuBarEnabled(enabled: boolean): void { + async setAutoHideMenuBarEnabled(enabled: boolean): Promise { throw new Error("Unimplemented"); } @@ -147,11 +136,11 @@ export default class BasePlatform { return false; } - async getMinimizeToTrayEnabled(): boolean { + async getMinimizeToTrayEnabled(): Promise { return false; } - async setMinimizeToTrayEnabled(enabled: boolean): void { + async setMinimizeToTrayEnabled(enabled: boolean): Promise { throw new Error("Unimplemented"); } diff --git a/src/indexing/BaseEventIndexManager.js b/src/indexing/BaseEventIndexManager.ts similarity index 97% rename from src/indexing/BaseEventIndexManager.js rename to src/indexing/BaseEventIndexManager.ts index f780c8e9ce..c40d1300ea 100644 --- a/src/indexing/BaseEventIndexManager.js +++ b/src/indexing/BaseEventIndexManager.ts @@ -1,5 +1,5 @@ /* -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. @@ -20,7 +20,7 @@ export interface MatrixEvent { content: {}; event_id: string; origin_server_ts: number; - unsigned: ?{}; + unsigned?: {}; room_id: string; } @@ -59,7 +59,7 @@ export interface SearchArgs { before_limit: number; after_limit: number; order_by_recency: boolean; - room_id: ?string; + room_id?: string; } export interface EventAndProfile { @@ -85,7 +85,7 @@ export interface IndexStats { * * Instances of this class are provided by the application. */ -export default class BaseEventIndexManager { +export default abstract class BaseEventIndexManager { /** * Does our EventIndexManager support event indexing. * @@ -119,7 +119,7 @@ export default class BaseEventIndexManager { * @return {Promise} A promise that will resolve when the was queued up for * addition. */ - async addEventToIndex(ev: MatrixEvent, profile: MatrixProfile): Promise<> { + async addEventToIndex(ev: MatrixEvent, profile: MatrixProfile): Promise { throw new Error("Unimplemented"); } @@ -188,7 +188,7 @@ export default class BaseEventIndexManager { events: [EventAndProfile], checkpoint: CrawlerCheckpoint | null, oldCheckpoint: CrawlerCheckpoint | null, - ): Promise { + ): Promise { throw new Error("Unimplemented"); } From 7b0e51a703ea8c4aa7420577dad0c1f9dbf11265 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 21 May 2020 18:11:21 +0100 Subject: [PATCH 02/12] delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/BasePlatform.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index 3f11f25d62..f7e32584c3 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -29,8 +29,8 @@ import {ActionPayload} from "./dispatcher/payloads"; * Instances of this class are provided by the application. */ export default abstract class BasePlatform { - protected notificationCount: number = 0; - protected errorDidOccur: boolean = false; + protected notificationCount = 0; + protected errorDidOccur = false; constructor() { dis.register(this.onAction); From 3ae38714c10de32f0064550e067401566bc3c728 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 21 May 2020 18:25:52 +0100 Subject: [PATCH 03/12] make ts happy Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/BasePlatform.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index f7e32584c3..d4a6c34daf 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -85,7 +85,8 @@ export default abstract class BasePlatform { abstract displayNotification(title: string, msg: string, avatarUrl: string, room: Object); - abstract loudNotification(ev: Event, room: Object); + loudNotification(ev: Event, room: Object) { + }; /** * Returns a promise that resolves to a string representing the current version of the application. From a425c5440b16c5d4d002a4e47115d93c15dcdc68 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 21 May 2020 16:34:23 -0600 Subject: [PATCH 04/12] Fix visibility of message timestamps Fixes https://github.com/vector-im/riot-web/issues/13736 This also fixes an unreported but complained about issue regarding the 'always show timestamps' option not working. Looks like this regressed in https://github.com/matrix-org/matrix-react-sdk/pull/4531 when things got shuffled around. --- res/css/views/rooms/_EventTile.scss | 9 ++++++++- res/css/views/rooms/_GroupLayout.scss | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index 4297bf809c..20652c6037 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -98,6 +98,7 @@ limitations under the License. .mx_EventTile .mx_MessageTimestamp { display: block; + visibility: hidden; white-space: nowrap; left: 0px; text-align: center; @@ -158,10 +159,16 @@ limitations under the License. } // Explicit relationships so that it doesn't apply to nested EventTile components (e.g in Replies) +// The first set is to handle the 'group layout' (default) and the second for the IRC layout .mx_EventTile_last > div > a > .mx_MessageTimestamp, .mx_EventTile:hover > div > a > .mx_MessageTimestamp, .mx_EventTile.mx_EventTile_actionBarFocused > div > a > .mx_MessageTimestamp, -.mx_EventTile.focus-visible:focus-within > div > a > .mx_MessageTimestamp { +.mx_EventTile.focus-visible:focus-within > div > a > .mx_MessageTimestamp, + +.mx_IRCLayout .mx_EventTile_last > a > .mx_MessageTimestamp, +.mx_IRCLayout .mx_EventTile:hover > a > .mx_MessageTimestamp, +.mx_IRCLayout .mx_EventTile.mx_EventTile_actionBarFocused > a > .mx_MessageTimestamp, +.mx_IRCLayout .mx_EventTile.focus-visible:focus-within > a > .mx_MessageTimestamp { visibility: visible; } diff --git a/res/css/views/rooms/_GroupLayout.scss b/res/css/views/rooms/_GroupLayout.scss index 40440f7d49..928ea75a79 100644 --- a/res/css/views/rooms/_GroupLayout.scss +++ b/res/css/views/rooms/_GroupLayout.scss @@ -34,7 +34,6 @@ $left-gutter: 65px; } .mx_MessageTimestamp { - visibility: hidden; position: absolute; width: 46px; /* 8 + 30 (avatar) + 8 */ } From ef4d0a805194e627606d3306f3b64fb22e1d87d8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 22 May 2020 10:33:19 +0100 Subject: [PATCH 05/12] Make linter happy --- res/css/views/rooms/_EventTile.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index 20652c6037..40a80f17bb 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -164,7 +164,6 @@ limitations under the License. .mx_EventTile:hover > div > a > .mx_MessageTimestamp, .mx_EventTile.mx_EventTile_actionBarFocused > div > a > .mx_MessageTimestamp, .mx_EventTile.focus-visible:focus-within > div > a > .mx_MessageTimestamp, - .mx_IRCLayout .mx_EventTile_last > a > .mx_MessageTimestamp, .mx_IRCLayout .mx_EventTile:hover > a > .mx_MessageTimestamp, .mx_IRCLayout .mx_EventTile.mx_EventTile_actionBarFocused > a > .mx_MessageTimestamp, From 6bfa31cd47d626fe10c9148f16557c6a2a86bedd Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 22 May 2020 10:34:00 +0100 Subject: [PATCH 06/12] run i18n which is unhappy about 'create room' for some reason --- src/i18n/strings/en_EN.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index f79d93b98f..96ccf1589d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1127,7 +1127,6 @@ "Low priority": "Low priority", "Historical": "Historical", "System Alerts": "System Alerts", - "Create room": "Create room", "This room": "This room", "Joining room …": "Joining room …", "Loading …": "Loading …", From badda5ae815d77165a90c6f5804192c8e1321a3d Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 19 May 2020 15:40:26 +0100 Subject: [PATCH 07/12] Remove SSSS key upgrade check from rageshake This code doesn't exist anymore as the SSSS symmetric upgrade stuff has been removed. Fixes https://github.com/vector-im/riot-web/issues/13715 --- src/rageshake/submit-rageshake.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rageshake/submit-rageshake.ts b/src/rageshake/submit-rageshake.ts index e5027e0d37..9f9d7898cb 100644 --- a/src/rageshake/submit-rageshake.ts +++ b/src/rageshake/submit-rageshake.ts @@ -133,7 +133,6 @@ export default async function sendBugReport(bugReportEndpoint: string, opts: IOp body.append("cross_signing_supported_by_hs", String(await client.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"))); body.append("cross_signing_ready", String(await client.isCrossSigningReady())); - body.append("ssss_key_needs_upgrade", String(await client.secretStorageKeyNeedsUpgrade())); } } From 0201655538d44c05e0135e6db92caf060ee166e7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 21 May 2020 12:26:27 +0100 Subject: [PATCH 08/12] Fix key backup restore with SSSS The room / session ID params come after the backupInfo for restoring from SSSS so the options object was being passed into the wrong param. Roll on TypeScript. This meant restoring backups worked fine when the key was cached but failed when it wasn't. Regressed in https://github.com/matrix-org/matrix-react-sdk/pull/4507 --- .../views/dialogs/keybackup/RestoreKeyBackupDialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js index 7e51e76f6c..a16202ed93 100644 --- a/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js +++ b/src/components/views/dialogs/keybackup/RestoreKeyBackupDialog.js @@ -201,7 +201,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent { // `accessSecretStorage` may prompt for storage access as needed. const recoverInfo = await accessSecretStorage(async () => { return MatrixClientPeg.get().restoreKeyBackupWithSecretStorage( - this.state.backupInfo, + this.state.backupInfo, undefined, undefined, { progressCallback: this._progressCallback }, ); }); From ac0d794877f4f2d2634087cfa57eecf1044ca83d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 22 May 2020 13:49:56 +0100 Subject: [PATCH 09/12] Fix: Tag_DM is not defined Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomList.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 1e5002419d..e4290f87d9 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -44,6 +44,7 @@ import {RoomListStoreTempProxy} from "../../../stores/room-list/RoomListStoreTem import {DefaultTagID} from "../../../stores/room-list/models"; import * as Unread from "../../../Unread"; import RoomViewStore from "../../../stores/RoomViewStore"; +import {TAG_DM} from "../../../stores/RoomListStore"; const HIDE_CONFERENCE_CHANS = true; const STANDARD_TAGS_REGEX = /^(m\.(favourite|lowpriority|server_notice)|im\.vector\.fake\.(invite|recent|direct|archived))$/; From 762918d664e4b5ab6ac2e7e36eabb0b26b75e6a6 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 22 May 2020 14:00:29 +0100 Subject: [PATCH 10/12] Prepare changelog for v2.6.1 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7901062b89..e5515f1015 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Changes in [2.6.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.6.1) (2020-05-22) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.6.0...v2.6.1) + + * Fix key backup restore with SSSS + [\#4617](https://github.com/matrix-org/matrix-react-sdk/pull/4617) + * Remove SSSS key upgrade check from rageshake + [\#4616](https://github.com/matrix-org/matrix-react-sdk/pull/4616) + Changes in [2.6.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v2.6.0) (2020-05-19) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v2.6.0-rc.1...v2.6.0) From 5a4da13e863ed554323e00fc1783eaaa776c923e Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 22 May 2020 14:00:29 +0100 Subject: [PATCH 11/12] v2.6.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28f3d1633c..6ceef02f24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "2.6.0", + "version": "2.6.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From af59d3a09423153056864ebd16eb10626a7d2ab7 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 22 May 2020 14:14:09 +0100 Subject: [PATCH 12/12] Reset matrix-js-sdk back to develop branch --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 6cdc771c5b..a97c093b87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5760,7 +5760,7 @@ mathml-tag-names@^2.0.1: "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "6.1.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/e3c6a0e1a08a3812ba988e60eb5a2a013bb27404" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/a4a7097c103da42075f2c70e070fd01fa6fb0d48" dependencies: "@babel/runtime" "^7.8.3" another-json "^0.2.0"