From 9287e8dfa4f55b368a3c108d3c15442cdfdc4c1c Mon Sep 17 00:00:00 2001
From: Panagiotis <27917356+panoschal@users.noreply.github.com>
Date: Mon, 8 Mar 2021 22:15:34 +0200
Subject: [PATCH 06/49] use isEncrypted, edit state events
---
src/components/structures/ViewSource.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/components/structures/ViewSource.js b/src/components/structures/ViewSource.js
index ddcffe4f7f..cfe28e9f73 100644
--- a/src/components/structures/ViewSource.js
+++ b/src/components/structures/ViewSource.js
@@ -51,7 +51,7 @@ export default class ViewSource extends React.Component {
// returns the dialog body for viewing the event source
viewSourceContent() {
const mxEvent = this.props.mxEvent.replacingEvent() || this.props.mxEvent; // show the replacing event, not the original, if it is an edit
- const isEncrypted = this.props.mxEvent.getType() !== this.props.mxEvent.getWireType();
+ const isEncrypted = mxEvent.isEncrypted();
const decryptedEventSource = mxEvent._clearEvent; // FIXME: _clearEvent is private
const originalEventSource = mxEvent.event;
@@ -85,7 +85,7 @@ export default class ViewSource extends React.Component {
// returns the id of the initial message, not the id of the previous edit
getBaseEventId() {
const mxEvent = this.props.mxEvent.replacingEvent() || this.props.mxEvent; // show the replacing event, not the original, if it is an edit
- const isEncrypted = this.props.mxEvent.getType() !== this.props.mxEvent.getWireType();
+ const isEncrypted = mxEvent.isEncrypted();
const baseMxEvent = this.props.mxEvent;
if (isEncrypted) {
@@ -163,7 +163,7 @@ export default class ViewSource extends React.Component {
const isEditing = this.state.isEditing;
const roomId = mxEvent.getRoomId();
const eventId = mxEvent.getId();
- const canEdit = canEditContent(this.props.mxEvent);
+ const canEdit = canEditContent(this.props.mxEvent) || mxEvent.isState();
return (
From 0936ea7e640ac10449150eaed1615bc99c52e70c Mon Sep 17 00:00:00 2001
From: Panagiotis <27917356+panoschal@users.noreply.github.com>
Date: Tue, 9 Mar 2021 14:46:37 +0200
Subject: [PATCH 07/49] feat: show edit button only when user has permissions
call appropriate functions for state events and edit message events
---
src/components/structures/ViewSource.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/components/structures/ViewSource.js b/src/components/structures/ViewSource.js
index cfe28e9f73..39666edd65 100644
--- a/src/components/structures/ViewSource.js
+++ b/src/components/structures/ViewSource.js
@@ -24,6 +24,7 @@ import * as sdk from "../../index";
import MatrixClientContext from "../../contexts/MatrixClientContext";
import { SendCustomEvent } from "../views/dialogs/DevtoolsDialog";
import { canEditContent } from "../../utils/EventUtils";
+import { MatrixClientPeg } from '../../MatrixClientPeg';
export default class ViewSource extends React.Component {
static propTypes = {
@@ -156,6 +157,12 @@ export default class ViewSource extends React.Component {
}
}
+ canSendStateEvent(mxEvent) {
+ const cli = MatrixClientPeg.get();
+ const room = cli.getRoom(mxEvent.getRoomId());
+ return room.currentState.mayClientSendStateEvent(mxEvent.getType(), cli);
+ }
+
render() {
const BaseDialog = sdk.getComponent("views.dialogs.BaseDialog");
const mxEvent = this.props.mxEvent.replacingEvent() || this.props.mxEvent; // show the replacing event, not the original, if it is an edit
@@ -163,7 +170,7 @@ export default class ViewSource extends React.Component {
const isEditing = this.state.isEditing;
const roomId = mxEvent.getRoomId();
const eventId = mxEvent.getId();
- const canEdit = canEditContent(this.props.mxEvent) || mxEvent.isState();
+ const canEdit = mxEvent.isState() ? this.canSendStateEvent(mxEvent) : canEditContent(this.props.mxEvent);
return (
From 681529aa3cb54b630fd02a25613d4f9e7379c536 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Wed, 10 Mar 2021 17:26:35 +0000
Subject: [PATCH 08/49] Upgrade matrix-js-sdk to 9.9.0-rc.1
---
package.json | 2 +-
yarn.lock | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/package.json b/package.json
index 7ed1b272da..e7fff438ff 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,7 @@
"katex": "^0.12.0",
"linkifyjs": "^2.1.9",
"lodash": "^4.17.20",
- "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
+ "matrix-js-sdk": "9.9.0-rc.1",
"matrix-widget-api": "^0.1.0-beta.13",
"minimist": "^1.2.5",
"pako": "^2.0.3",
diff --git a/yarn.lock b/yarn.lock
index f99ea5900d..5c78e70590 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5572,9 +5572,10 @@ mathml-tag-names@^2.1.3:
resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3"
integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==
-"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop":
- version "9.8.0"
- resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/fb73ab687826e4d05fb8b424ab013a771213f84f"
+matrix-js-sdk@9.9.0-rc.1:
+ version "9.9.0-rc.1"
+ resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.9.0-rc.1.tgz#5ee28aee89a87ccdf742d1512bc44ec54454e94f"
+ integrity sha512-A3pY5CyCNE5+QdpYL/C7FGU8KjBojXRWbtWsbeTMFwZEuzkIYlCtev1i07NbN3kbF83R3TtOfSCxQITm1C5jwg==
dependencies:
"@babel/runtime" "^7.12.5"
another-json "^0.2.0"
From 89f561a1ee645873e0a93fe1a6bc8967560ae8ab Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Wed, 10 Mar 2021 17:31:17 +0000
Subject: [PATCH 09/49] Prepare changelog for v3.16.0-rc.1
---
CHANGELOG.md | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c31eedf93b..d4ffeb5fbf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,110 @@
+Changes in [3.16.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.16.0-rc.1) (2021-03-10)
+===============================================================================================================
+[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.15.0...v3.16.0-rc.1)
+
+ * Upgrade to JS SDK 9.9.0-rc.1
+ * Translations update from Weblate
+ [\#5743](https://github.com/matrix-org/matrix-react-sdk/pull/5743)
+ * Document behaviour of showReadReceipts=false for sent receipts
+ [\#5739](https://github.com/matrix-org/matrix-react-sdk/pull/5739)
+ * Tweak sent marker code style
+ [\#5741](https://github.com/matrix-org/matrix-react-sdk/pull/5741)
+ * Fix sent markers disappearing for edits/reactions
+ [\#5737](https://github.com/matrix-org/matrix-react-sdk/pull/5737)
+ * Ignore to-device decryption in the room list store
+ [\#5740](https://github.com/matrix-org/matrix-react-sdk/pull/5740)
+ * Spaces suggested rooms support
+ [\#5736](https://github.com/matrix-org/matrix-react-sdk/pull/5736)
+ * Add tooltips to sent/sending receipts
+ [\#5738](https://github.com/matrix-org/matrix-react-sdk/pull/5738)
+ * Remove a bunch of useless 'use strict' definitions
+ [\#5735](https://github.com/matrix-org/matrix-react-sdk/pull/5735)
+ * [SK-1] Fix types for replaceableComponent
+ [\#5732](https://github.com/matrix-org/matrix-react-sdk/pull/5732)
+ * [SK-2] Make debugging skinning problems easier
+ [\#5733](https://github.com/matrix-org/matrix-react-sdk/pull/5733)
+ * Support sending invite reasons with /invite command
+ [\#5695](https://github.com/matrix-org/matrix-react-sdk/pull/5695)
+ * Fix clicking on the avatar for opening member info requires pixel-perfect
+ accuracy
+ [\#5717](https://github.com/matrix-org/matrix-react-sdk/pull/5717)
+ * Display decrypted and encrypted event source on the same dialog
+ [\#5713](https://github.com/matrix-org/matrix-react-sdk/pull/5713)
+ * Fix units of TURN server expiry time
+ [\#5730](https://github.com/matrix-org/matrix-react-sdk/pull/5730)
+ * Display room name in pills instead of address
+ [\#5624](https://github.com/matrix-org/matrix-react-sdk/pull/5624)
+ * Refresh UI for file uploads
+ [\#5723](https://github.com/matrix-org/matrix-react-sdk/pull/5723)
+ * UI refresh for uploaded files
+ [\#5719](https://github.com/matrix-org/matrix-react-sdk/pull/5719)
+ * Improve message sending states to match new designs
+ [\#5699](https://github.com/matrix-org/matrix-react-sdk/pull/5699)
+ * Add clipboard write permission for widgets
+ [\#5725](https://github.com/matrix-org/matrix-react-sdk/pull/5725)
+ * Fix widget resizing
+ [\#5722](https://github.com/matrix-org/matrix-react-sdk/pull/5722)
+ * Option for audio streaming
+ [\#5707](https://github.com/matrix-org/matrix-react-sdk/pull/5707)
+ * Show a specific error for hs_disabled
+ [\#5576](https://github.com/matrix-org/matrix-react-sdk/pull/5576)
+ * Add Edge to the targets list
+ [\#5721](https://github.com/matrix-org/matrix-react-sdk/pull/5721)
+ * File drop UI fixes and improvements
+ [\#5505](https://github.com/matrix-org/matrix-react-sdk/pull/5505)
+ * Fix Bottom border of state counters is white on the dark theme
+ [\#5715](https://github.com/matrix-org/matrix-react-sdk/pull/5715)
+ * Trim spurious whitespace of nicknames
+ [\#5332](https://github.com/matrix-org/matrix-react-sdk/pull/5332)
+ * Ensure HostSignupDialog border colour matches light theme
+ [\#5716](https://github.com/matrix-org/matrix-react-sdk/pull/5716)
+ * Don't place another call if there's already one ongoing
+ [\#5712](https://github.com/matrix-org/matrix-react-sdk/pull/5712)
+ * Space room hierarchies
+ [\#5706](https://github.com/matrix-org/matrix-react-sdk/pull/5706)
+ * Iterate Space view and right panel
+ [\#5705](https://github.com/matrix-org/matrix-react-sdk/pull/5705)
+ * Add a scroll to bottom on message sent setting
+ [\#5692](https://github.com/matrix-org/matrix-react-sdk/pull/5692)
+ * Add .tmp files to gitignore
+ [\#5708](https://github.com/matrix-org/matrix-react-sdk/pull/5708)
+ * Initial Space Room View and Creation UX
+ [\#5704](https://github.com/matrix-org/matrix-react-sdk/pull/5704)
+ * Add multi language spell check
+ [\#5452](https://github.com/matrix-org/matrix-react-sdk/pull/5452)
+ * Fix tetris effect (holes) in read receipts
+ [\#5697](https://github.com/matrix-org/matrix-react-sdk/pull/5697)
+ * Fixed edit for markdown images
+ [\#5703](https://github.com/matrix-org/matrix-react-sdk/pull/5703)
+ * Iterate Space Panel
+ [\#5702](https://github.com/matrix-org/matrix-react-sdk/pull/5702)
+ * Fix read receipts for compact layout
+ [\#5700](https://github.com/matrix-org/matrix-react-sdk/pull/5700)
+ * Space Store and Space Panel for Room List filtering
+ [\#5689](https://github.com/matrix-org/matrix-react-sdk/pull/5689)
+ * Log when turn creds expire
+ [\#5691](https://github.com/matrix-org/matrix-react-sdk/pull/5691)
+ * Null check for maxHeight in call view
+ [\#5690](https://github.com/matrix-org/matrix-react-sdk/pull/5690)
+ * Autocomplete invited users
+ [\#5687](https://github.com/matrix-org/matrix-react-sdk/pull/5687)
+ * Add send message button
+ [\#5535](https://github.com/matrix-org/matrix-react-sdk/pull/5535)
+ * Move call buttons to the room header
+ [\#5693](https://github.com/matrix-org/matrix-react-sdk/pull/5693)
+ * Use the default SSSS key if the default is set
+ [\#5638](https://github.com/matrix-org/matrix-react-sdk/pull/5638)
+ * Initial Spaces feature flag
+ [\#5668](https://github.com/matrix-org/matrix-react-sdk/pull/5668)
+ * Clean up code edge cases and add helpers
+ [\#5667](https://github.com/matrix-org/matrix-react-sdk/pull/5667)
+ * Clean up widgets when leaving the room
+ [\#5684](https://github.com/matrix-org/matrix-react-sdk/pull/5684)
+ * Fix read receipts?
+ [\#5567](https://github.com/matrix-org/matrix-react-sdk/pull/5567)
+ * Fix MAU usage alerts
+ [\#5678](https://github.com/matrix-org/matrix-react-sdk/pull/5678)
+
Changes in [3.15.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.15.0) (2021-03-01)
=====================================================================================================
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.15.0-rc.1...v3.15.0)
From ad1f9edba8297495bf54675bf7c3555fa0b197b6 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Wed, 10 Mar 2021 17:31:19 +0000
Subject: [PATCH 10/49] v3.16.0-rc.1
---
package.json | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index e7fff438ff..080b16b4ea 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "matrix-react-sdk",
- "version": "3.15.0",
+ "version": "3.16.0-rc.1",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
@@ -27,7 +27,7 @@
"matrix-gen-i18n": "scripts/gen-i18n.js",
"matrix-prune-i18n": "scripts/prune-i18n.js"
},
- "main": "./src/index.js",
+ "main": "./lib/index.js",
"matrix_src_main": "./src/index.js",
"matrix_lib_main": "./lib/index.js",
"matrix_lib_typings": "./lib/index.d.ts",
@@ -189,5 +189,6 @@
"transformIgnorePatterns": [
"/node_modules/(?!matrix-js-sdk).+$"
]
- }
+ },
+ "typings": "./lib/index.d.ts"
}
From 79ba898b3d6fc1264e785d24fbdfb3a8a9020854 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Wed, 10 Mar 2021 18:08:55 +0000
Subject: [PATCH 11/49] Prepare changelog for v3.16.0-rc.2
---
CHANGELOG.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d4ffeb5fbf..0b130d1c70 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+Changes in [3.16.0-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.16.0-rc.2) (2021-03-10)
+===============================================================================================================
+[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.16.0-rc.1...v3.16.0-rc.2)
+
+ * Fixed incorrect build output in rc.1
+
Changes in [3.16.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.16.0-rc.1) (2021-03-10)
===============================================================================================================
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.15.0...v3.16.0-rc.1)
From 71a3847c35aac3ad58bf49b5e15d986b55d32464 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Wed, 10 Mar 2021 18:08:56 +0000
Subject: [PATCH 12/49] v3.16.0-rc.2
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 080b16b4ea..ddc352104c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "matrix-react-sdk",
- "version": "3.16.0-rc.1",
+ "version": "3.16.0-rc.2",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
From 93f7f13c442c0faefd15d04e512bc3575c784585 Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Wed, 3 Mar 2021 18:16:27 -0700
Subject: [PATCH 13/49] Early proof of concept for media customization support
---
src/customisations/Media.ts | 138 ++++++++++++++++++
.../models/IMediaEventContent.ts | 87 +++++++++++
src/utils/DecryptFile.js | 5 +-
3 files changed, 228 insertions(+), 2 deletions(-)
create mode 100644 src/customisations/Media.ts
create mode 100644 src/customisations/models/IMediaEventContent.ts
diff --git a/src/customisations/Media.ts b/src/customisations/Media.ts
new file mode 100644
index 0000000000..27abc6bc50
--- /dev/null
+++ b/src/customisations/Media.ts
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2021 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.
+ * 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.
+ */
+
+import {MatrixClientPeg} from "../MatrixClientPeg";
+import {IMediaEventContent, IPreparedMedia, prepEventContentAsMedia} from "./models/IMediaEventContent";
+
+// Populate this class with the details of your customisations when copying it.
+
+// Implementation note: The Media class must complete the contract as shown here, though
+// the constructor can be whatever is relevant to your implementation. The mediaForX
+// functions below create an instance of the Media class and are used throughout the
+// project.
+
+/**
+ * A media object is a representation of a "source media" and an optional
+ * "thumbnail media", derived from event contents or external sources.
+ */
+export class Media {
+ // Per above, this constructor signature can be whatever is helpful for you.
+ constructor(private prepared: IPreparedMedia) {
+ }
+
+ /**
+ * The MXC URI of the source media.
+ */
+ public get srcMxc(): string {
+ return this.prepared.mxc;
+ }
+
+ /**
+ * The MXC URI of the thumbnail media, if a thumbnail is recorded. Null/undefined
+ * otherwise.
+ */
+ public get thumbnailMxc(): string | undefined | null {
+ return this.prepared.thumbnail?.mxc;
+ }
+
+ /**
+ * Whether or not a thumbnail is recorded for this media.
+ */
+ public get hasThumbnail(): boolean {
+ return !!this.thumbnailMxc;
+ }
+
+ /**
+ * The HTTP URL for the source media.
+ */
+ public get srcHttp(): string {
+ return MatrixClientPeg.get().mxcUrlToHttp(this.srcMxc);
+ }
+
+ /**
+ * Gets the HTTP URL for the thumbnail media with the requested characteristics, if a thumbnail
+ * is recorded for this media. Returns null/undefined otherwise.
+ * @param {number} width The desired width of the thumbnail.
+ * @param {number} height The desired height of the thumbnail.
+ * @param {"scale"|"crop"} mode The desired thumbnailing mode. Defaults to scale.
+ * @returns {string} The HTTP URL which points to the thumbnail.
+ */
+ public getThumbnailHttp(width: number, height: number, mode: 'scale' | 'crop' = "scale"): string | null | undefined {
+ if (!this.hasThumbnail) return null;
+ return MatrixClientPeg.get().mxcUrlToHttp(this.thumbnailMxc, width, height, mode);
+ }
+
+ /**
+ * Gets the HTTP URL for a thumbnail of the source media with the requested characteristics.
+ * @param {number} width The desired width of the thumbnail.
+ * @param {number} height The desired height of the thumbnail.
+ * @param {"scale"|"crop"} mode The desired thumbnailing mode. Defaults to scale.
+ * @returns {string} The HTTP URL which points to the thumbnail.
+ */
+ public getThumbnailOfSourceHttp(width: number, height: number, mode: 'scale' | 'crop' = "scale"): string {
+ return MatrixClientPeg.get().mxcUrlToHttp(this.srcMxc, width, height, mode);
+ }
+
+ /**
+ * Downloads the source media.
+ * @returns {Promise} Resolves to the server's response for chaining.
+ */
+ public downloadSource(): Promise {
+ return fetch(this.srcHttp);
+ }
+
+ /**
+ * Downloads the thumbnail media with the requested characteristics. If no thumbnail media is present,
+ * this throws an exception.
+ * @param {number} width The desired width of the thumbnail.
+ * @param {number} height The desired height of the thumbnail.
+ * @param {"scale"|"crop"} mode The desired thumbnailing mode. Defaults to scale.
+ * @returns {Promise} Resolves to the server's response for chaining.
+ */
+ public downloadThumbnail(width: number, height: number, mode: 'scale' | 'crop' = "scale"): Promise {
+ if (!this.hasThumbnail) throw new Error("Cannot download non-existent thumbnail");
+ return fetch(this.getThumbnailHttp(width, height, mode));
+ }
+
+ /**
+ * Downloads a thumbnail of the source media with the requested characteristics.
+ * @param {number} width The desired width of the thumbnail.
+ * @param {number} height The desired height of the thumbnail.
+ * @param {"scale"|"crop"} mode The desired thumbnailing mode. Defaults to scale.
+ * @returns {Promise} Resolves to the server's response for chaining.
+ */
+ public downloadThumbnailOfSource(width: number, height: number, mode: 'scale' | 'crop' = "scale"): Promise {
+ return fetch(this.getThumbnailOfSourceHttp(width, height, mode));
+ }
+}
+
+/**
+ * Creates a media object from event content.
+ * @param {IMediaEventContent} content The event content.
+ * @returns {Media} The media object.
+ */
+export function mediaFromContent(content: IMediaEventContent): Media {
+ return new Media(prepEventContentAsMedia(content));
+}
+
+/**
+ * Creates a media object from an MXC URI.
+ * @param {string} mxc The MXC URI.
+ * @returns {Media} The media object.
+ */
+export function mediaFromMxc(mxc: string): Media {
+ return mediaFromContent({url: mxc});
+}
diff --git a/src/customisations/models/IMediaEventContent.ts b/src/customisations/models/IMediaEventContent.ts
new file mode 100644
index 0000000000..0211a63787
--- /dev/null
+++ b/src/customisations/models/IMediaEventContent.ts
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2021 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.
+ * 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.
+ */
+
+// TODO: These types should be elsewhere.
+
+export interface IEncryptedFile {
+ url: string;
+ key: {
+ alg: string;
+ key_ops: string[];
+ kty: string;
+ k: string;
+ ext: boolean;
+ };
+ iv: string;
+ hashes: {[alg: string]: string};
+ v: string;
+}
+
+export interface IMediaEventContent {
+ url?: string; // required on unencrypted media
+ file?: IEncryptedFile; // required for *encrypted* media
+ info?: {
+ thumbnail_url?: string;
+ thumbnail_file?: IEncryptedFile;
+ };
+}
+
+export interface IPreparedMedia extends IMediaObject {
+ thumbnail?: IMediaObject;
+}
+
+export interface IMediaObject {
+ mxc: string;
+ file?: IEncryptedFile;
+}
+
+/**
+ * Parses an event content body into a prepared media object. This prepared media object
+ * can be used with other functions to manipulate the media.
+ * @param {IMediaEventContent} content Unredacted media event content. See interface.
+ * @returns {IPreparedMedia} A prepared media object.
+ * @throws Throws if the given content cannot be packaged into a prepared media object.
+ */
+export function prepEventContentAsMedia(content: IMediaEventContent): IPreparedMedia {
+ let thumbnail: IMediaObject = null;
+ if (content?.info?.thumbnail_url) {
+ thumbnail = {
+ mxc: content.info.thumbnail_url,
+ file: content.info.thumbnail_file,
+ };
+ } else if (content?.info?.thumbnail_file?.url) {
+ thumbnail = {
+ mxc: content.info.thumbnail_file.url,
+ file: content.info.thumbnail_file,
+ };
+ }
+
+ if (content?.url) {
+ return {
+ thumbnail,
+ mxc: content.url,
+ file: content.file,
+ };
+ } else if (content?.file?.url) {
+ return {
+ thumbnail,
+ mxc: content.file.url,
+ file: content.file,
+ };
+ }
+
+ throw new Error("Invalid file provided: cannot determine MXC URI. Has it been redacted?");
+}
diff --git a/src/utils/DecryptFile.js b/src/utils/DecryptFile.js
index d3625d614a..fb3600cd79 100644
--- a/src/utils/DecryptFile.js
+++ b/src/utils/DecryptFile.js
@@ -19,6 +19,7 @@ limitations under the License.
import encrypt from 'browser-encrypt-attachment';
// Grab the client so that we can turn mxc:// URLs into https:// URLS.
import {MatrixClientPeg} from '../MatrixClientPeg';
+import {mediaFromContent} from "../customisations/Media";
// WARNING: We have to be very careful about what mime-types we allow into blobs,
// as for performance reasons these are now rendered via URL.createObjectURL()
@@ -87,9 +88,9 @@ const ALLOWED_BLOB_MIMETYPES = {
* @returns {Promise}
*/
export function decryptFile(file) {
- const url = MatrixClientPeg.get().mxcUrlToHttp(file.url);
+ const media = mediaFromContent({file});
// Download the encrypted file as an array buffer.
- return Promise.resolve(fetch(url)).then(function(response) {
+ return media.downloadSource().then(function(response) {
return response.arrayBuffer();
}).then(function(responseData) {
// Decrypt the array buffer using the information taken from
From 53935782bcaa51daab0011ff16236943e994f153 Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Wed, 3 Mar 2021 18:22:57 -0700
Subject: [PATCH 14/49] Convert DecryptFile to TS and modernize a bit
---
.../models/IMediaEventContent.ts | 1 +
src/utils/{DecryptFile.js => DecryptFile.ts} | 63 +++++++++----------
2 files changed, 30 insertions(+), 34 deletions(-)
rename src/utils/{DecryptFile.js => DecryptFile.ts} (76%)
diff --git a/src/customisations/models/IMediaEventContent.ts b/src/customisations/models/IMediaEventContent.ts
index 0211a63787..4cbe07dbd5 100644
--- a/src/customisations/models/IMediaEventContent.ts
+++ b/src/customisations/models/IMediaEventContent.ts
@@ -18,6 +18,7 @@
export interface IEncryptedFile {
url: string;
+ mimetype?: string;
key: {
alg: string;
key_ops: string[];
diff --git a/src/utils/DecryptFile.js b/src/utils/DecryptFile.ts
similarity index 76%
rename from src/utils/DecryptFile.js
rename to src/utils/DecryptFile.ts
index fb3600cd79..93cedbc707 100644
--- a/src/utils/DecryptFile.js
+++ b/src/utils/DecryptFile.ts
@@ -1,6 +1,5 @@
/*
-Copyright 2016 OpenMarket Ltd
-Copyright 2018 New Vector Ltd
+Copyright 2016, 2018, 2021 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.
@@ -17,9 +16,8 @@ limitations under the License.
// Pull in the encryption lib so that we can decrypt attachments.
import encrypt from 'browser-encrypt-attachment';
-// Grab the client so that we can turn mxc:// URLs into https:// URLS.
-import {MatrixClientPeg} from '../MatrixClientPeg';
import {mediaFromContent} from "../customisations/Media";
+import {IEncryptedFile} from "../customisations/models/IMediaEventContent";
// WARNING: We have to be very careful about what mime-types we allow into blobs,
// as for performance reasons these are now rendered via URL.createObjectURL()
@@ -55,48 +53,46 @@ import {mediaFromContent} from "../customisations/Media";
// For the record, mime-types which must NEVER enter this list below include:
// text/html, text/xhtml, image/svg, image/svg+xml, image/pdf, and similar.
-const ALLOWED_BLOB_MIMETYPES = {
- 'image/jpeg': true,
- 'image/gif': true,
- 'image/png': true,
+const ALLOWED_BLOB_MIMETYPES = [
+ 'image/jpeg',
+ 'image/gif',
+ 'image/png',
- 'video/mp4': true,
- 'video/webm': true,
- 'video/ogg': true,
+ 'video/mp4',
+ 'video/webm',
+ 'video/ogg',
- 'audio/mp4': true,
- 'audio/webm': true,
- 'audio/aac': true,
- 'audio/mpeg': true,
- 'audio/ogg': true,
- 'audio/wave': true,
- 'audio/wav': true,
- 'audio/x-wav': true,
- 'audio/x-pn-wav': true,
- 'audio/flac': true,
- 'audio/x-flac': true,
-};
+ 'audio/mp4',
+ 'audio/webm',
+ 'audio/aac',
+ 'audio/mpeg',
+ 'audio/ogg',
+ 'audio/wave',
+ 'audio/wav',
+ 'audio/x-wav',
+ 'audio/x-pn-wav',
+ 'audio/flac',
+ 'audio/x-flac',
+];
/**
* Decrypt a file attached to a matrix event.
- * @param {Object} file The json taken from the matrix event.
+ * @param {IEncryptedFile} file The json taken from the matrix event.
* This passed to [link]{@link https://github.com/matrix-org/browser-encrypt-attachments}
* as the encryption info object, so will also have the those keys in addition to
* the keys below.
- * @param {string} file.url An mxc:// URL for the encrypted file.
- * @param {string} file.mimetype The MIME-type of the plaintext file.
- * @returns {Promise}
+ * @returns {Promise} Resolves to a Blob of the file.
*/
-export function decryptFile(file) {
+export function decryptFile(file: IEncryptedFile): Promise {
const media = mediaFromContent({file});
// Download the encrypted file as an array buffer.
- return media.downloadSource().then(function(response) {
+ return media.downloadSource().then((response) => {
return response.arrayBuffer();
- }).then(function(responseData) {
+ }).then((responseData) => {
// Decrypt the array buffer using the information taken from
// the event content.
return encrypt.decryptAttachment(responseData, file);
- }).then(function(dataArray) {
+ }).then((dataArray) => {
// Turn the array into a Blob and give it the correct MIME-type.
// IMPORTANT: we must not allow scriptable mime-types into Blobs otherwise
@@ -104,11 +100,10 @@ export function decryptFile(file) {
// browser (e.g. by copying the URI into a new tab or window.)
// See warning at top of file.
let mimetype = file.mimetype ? file.mimetype.split(";")[0].trim() : '';
- if (!ALLOWED_BLOB_MIMETYPES[mimetype]) {
+ if (!ALLOWED_BLOB_MIMETYPES.includes(mimetype)) {
mimetype = 'application/octet-stream';
}
- const blob = new Blob([dataArray], {type: mimetype});
- return blob;
+ return new Blob([dataArray], {type: mimetype});
});
}
From 1ac12479ca7b132b9d9d4eddc64ed6aa9b7fbde0 Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Wed, 3 Mar 2021 19:06:46 -0700
Subject: [PATCH 15/49] Convert cases of mxcUrlToHttp to new media
customisation
---
src/HtmlUtils.tsx | 9 ++---
src/Notifier.ts | 3 +-
src/autocomplete/CommunityProvider.tsx | 3 +-
src/components/structures/GroupView.js | 11 +++---
src/components/structures/LeftPanel.tsx | 3 +-
.../structures/SpaceRoomDirectory.tsx | 15 ++------
src/components/views/avatars/GroupAvatar.tsx | 9 +++--
.../views/dialogs/ConfirmUserActionDialog.js | 6 ++-
.../dialogs/EditCommunityPrototypeDialog.tsx | 3 +-
.../views/dialogs/IncomingSasDialog.js | 20 +++++-----
src/components/views/elements/AddressTile.js | 5 +--
src/components/views/elements/Flair.js | 4 +-
src/components/views/elements/Pill.js | 3 +-
src/components/views/elements/SSOButtons.tsx | 3 +-
src/components/views/elements/TagTile.js | 13 ++++---
.../views/groups/GroupInviteTile.js | 6 ++-
.../views/groups/GroupMemberTile.js | 8 ++--
src/components/views/groups/GroupRoomInfo.js | 7 ++--
src/components/views/groups/GroupRoomTile.js | 8 ++--
src/components/views/groups/GroupTile.js | 6 ++-
src/components/views/messages/MAudioBody.js | 7 ++--
src/components/views/messages/MFileBody.js | 5 ++-
src/components/views/messages/MImageBody.js | 36 +++++++-----------
src/components/views/messages/MVideoBody.tsx | 14 ++++---
.../views/messages/RoomAvatarEvent.js | 3 +-
src/components/views/right_panel/UserInfo.tsx | 3 +-
.../room_settings/RoomProfileSettings.js | 5 ++-
.../views/rooms/LinkPreviewWidget.js | 9 +++--
src/components/views/settings/ChangeAvatar.js | 3 +-
.../views/settings/ProfileSettings.js | 5 ++-
src/customisations/Media.ts | 38 +++++++++++++++++--
src/customisations/models/ResizeMode.ts | 17 +++++++++
src/stores/OwnProfileStore.ts | 9 ++++-
33 files changed, 178 insertions(+), 121 deletions(-)
create mode 100644 src/customisations/models/ResizeMode.ts
diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx
index 7d6b049914..12752eb20f 100644
--- a/src/HtmlUtils.tsx
+++ b/src/HtmlUtils.tsx
@@ -36,6 +36,7 @@ import {MatrixClientPeg} from './MatrixClientPeg';
import {tryTransformPermalinkToLocalHref} from "./utils/permalinks/Permalinks";
import {SHORTCODE_TO_EMOJI, getEmojiFromUnicode} from "./emoji";
import ReplyThread from "./components/views/elements/ReplyThread";
+import {mediaFromMxc} from "./customisations/Media";
linkifyMatrix(linkify);
@@ -181,11 +182,9 @@ const transformTags: IExtendedSanitizeOptions["transformTags"] = { // custom to
if (!attribs.src || !attribs.src.startsWith('mxc://') || !SettingsStore.getValue("showImages")) {
return { tagName, attribs: {}};
}
- attribs.src = MatrixClientPeg.get().mxcUrlToHttp(
- attribs.src,
- attribs.width || 800,
- attribs.height || 600,
- );
+ const width = Number(attribs.width) || 800;
+ const height = Number(attribs.height) || 600;
+ attribs.src = mediaFromMxc(attribs.src).getThumbnailOfSourceHttp(width, height);
return { tagName, attribs };
},
'code': function(tagName: string, attribs: sanitizeHtml.Attributes) {
diff --git a/src/Notifier.ts b/src/Notifier.ts
index 6460be20ad..f68bfabc18 100644
--- a/src/Notifier.ts
+++ b/src/Notifier.ts
@@ -36,6 +36,7 @@ import {SettingLevel} from "./settings/SettingLevel";
import {isPushNotifyDisabled} from "./settings/controllers/NotificationControllers";
import RoomViewStore from "./stores/RoomViewStore";
import UserActivity from "./UserActivity";
+import {mediaFromMxc} from "./customisations/Media";
/*
* Dispatches:
@@ -150,7 +151,7 @@ export const Notifier = {
// Ideally in here we could use MSC1310 to detect the type of file, and reject it.
return {
- url: MatrixClientPeg.get().mxcUrlToHttp(content.url),
+ url: mediaFromMxc(content.url).srcHttp,
name: content.name,
type: content.type,
size: content.size,
diff --git a/src/autocomplete/CommunityProvider.tsx b/src/autocomplete/CommunityProvider.tsx
index ebf5d536ec..b7a4e0960e 100644
--- a/src/autocomplete/CommunityProvider.tsx
+++ b/src/autocomplete/CommunityProvider.tsx
@@ -27,6 +27,7 @@ import {sortBy} from "lodash";
import {makeGroupPermalink} from "../utils/permalinks/Permalinks";
import {ICompletion, ISelectionRange} from "./Autocompleter";
import FlairStore from "../stores/FlairStore";
+import {mediaFromMxc} from "../customisations/Media";
const COMMUNITY_REGEX = /\B\+\S*/g;
@@ -95,7 +96,7 @@ export default class CommunityProvider extends AutocompleteProvider {
name={name || groupId}
width={24}
height={24}
- url={avatarUrl ? cli.mxcUrlToHttp(avatarUrl, 24, 24) : null} />
+ url={avatarUrl ? mediaFromMxc(avatarUrl).getSquareThumbnailHttp(24) : null} />
),
range,
diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js
index b4b871a0b4..f05d8d0758 100644
--- a/src/components/structures/GroupView.js
+++ b/src/components/structures/GroupView.js
@@ -39,6 +39,7 @@ import {Group} from "matrix-js-sdk";
import {allSettled, sleep} from "../../utils/promise";
import RightPanelStore from "../../stores/RightPanelStore";
import AutoHideScrollbar from "./AutoHideScrollbar";
+import {mediaFromMxc} from "../../customisations/Media";
import {replaceableComponent} from "../../utils/replaceableComponent";
const LONG_DESC_PLACEHOLDER = _td(
@@ -368,8 +369,7 @@ class FeaturedUser extends React.Component {
const permalink = makeUserPermalink(this.props.summaryInfo.user_id);
const userNameNode = { name };
- const httpUrl = MatrixClientPeg.get()
- .mxcUrlToHttp(this.props.summaryInfo.avatar_url, 64, 64);
+ const httpUrl = mediaFromMxc(this.props.summaryInfo.avatar_url).getSquareThumbnailHttp(64);
const deleteButton = this.props.editing ?
;
From 62983ca48efd4ec4087a5d29cce3b11acce6d34a Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Mon, 15 Mar 2021 12:57:35 +0000
Subject: [PATCH 39/49] Fix space panel alignments when no scrollbar is present
---
res/css/structures/_SpacePanel.scss | 5 +----
res/css/structures/_SpaceRoomDirectory.scss | 1 +
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/res/css/structures/_SpacePanel.scss b/res/css/structures/_SpacePanel.scss
index f489d7b8b5..afcf48ec4d 100644
--- a/res/css/structures/_SpacePanel.scss
+++ b/res/css/structures/_SpacePanel.scss
@@ -35,6 +35,7 @@ $activeBorderColor: $secondary-fg-color;
.mx_SpacePanel_spaceTreeWrapper {
flex: 1;
+ overflow-y: scroll;
}
.mx_SpacePanel_toggleCollapse {
@@ -132,10 +133,6 @@ $activeBorderColor: $secondary-fg-color;
}
}
- &.mx_SpaceButton_narrow {
- margin-right: 10px;
- }
-
.mx_SpaceButton_name {
flex: 1;
margin-left: 8px;
diff --git a/res/css/structures/_SpaceRoomDirectory.scss b/res/css/structures/_SpaceRoomDirectory.scss
index c96398594f..b14e92a1af 100644
--- a/res/css/structures/_SpaceRoomDirectory.scss
+++ b/res/css/structures/_SpaceRoomDirectory.scss
@@ -132,6 +132,7 @@ limitations under the License.
height: min-content;
margin-left: auto;
margin-right: 16px;
+ display: inline-flex;
}
}
From da627dab20656757fa46d5a95fe8717571852011 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Mon, 15 Mar 2021 14:38:57 +0000
Subject: [PATCH 40/49] Upgrade matrix-js-sdk to 9.9.0
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index ddc352104c..7324d5b352 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,7 @@
"katex": "^0.12.0",
"linkifyjs": "^2.1.9",
"lodash": "^4.17.20",
- "matrix-js-sdk": "9.9.0-rc.1",
+ "matrix-js-sdk": "9.9.0",
"matrix-widget-api": "^0.1.0-beta.13",
"minimist": "^1.2.5",
"pako": "^2.0.3",
diff --git a/yarn.lock b/yarn.lock
index 5c78e70590..aaee47b876 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5572,10 +5572,10 @@ mathml-tag-names@^2.1.3:
resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3"
integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==
-matrix-js-sdk@9.9.0-rc.1:
- version "9.9.0-rc.1"
- resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.9.0-rc.1.tgz#5ee28aee89a87ccdf742d1512bc44ec54454e94f"
- integrity sha512-A3pY5CyCNE5+QdpYL/C7FGU8KjBojXRWbtWsbeTMFwZEuzkIYlCtev1i07NbN3kbF83R3TtOfSCxQITm1C5jwg==
+matrix-js-sdk@9.9.0:
+ version "9.9.0"
+ resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.9.0.tgz#30c46419c026fcad0ff25aea9417b77921f64c6d"
+ integrity sha512-rgy9b8D+GzjK3wfdmxDr42fxNV13fK12cvQD1qnsFzqPyJGeg++cazH/+7HxL/uuW/WQR6HAmfc7wo9VQegWtg==
dependencies:
"@babel/runtime" "^7.12.5"
another-json "^0.2.0"
From 2ef9f3327e1c2635a8c9cb4e8df8a48521ac3e4b Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Mon, 15 Mar 2021 14:45:35 +0000
Subject: [PATCH 41/49] Prepare changelog for v3.16.0
---
CHANGELOG.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b130d1c70..ea4b015ee9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+Changes in [3.16.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.16.0) (2021-03-15)
+=====================================================================================================
+[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.16.0-rc.2...v3.16.0)
+
+ * [Release] Change read receipt drift to be non-fractional
+ [\#5746](https://github.com/matrix-org/matrix-react-sdk/pull/5746)
+ * [Release] Properly gate SpaceRoomView behind labs
+ [\#5750](https://github.com/matrix-org/matrix-react-sdk/pull/5750)
+
Changes in [3.16.0-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.16.0-rc.2) (2021-03-10)
===============================================================================================================
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.16.0-rc.1...v3.16.0-rc.2)
From 44fd41cb1e769038914025c836c8d241ad2b4be6 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Mon, 15 Mar 2021 14:45:36 +0000
Subject: [PATCH 42/49] v3.16.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 7324d5b352..5bbb2a0a15 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "matrix-react-sdk",
- "version": "3.16.0-rc.2",
+ "version": "3.16.0",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
From 1d1263c39a6b261bb5c6fde9a244377e16b4a1e5 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Mon, 15 Mar 2021 14:46:57 +0000
Subject: [PATCH 43/49] Resetting package fields for development
---
package.json | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 2841e01824..ab450f0526 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
"matrix-gen-i18n": "scripts/gen-i18n.js",
"matrix-prune-i18n": "scripts/prune-i18n.js"
},
- "main": "./lib/index.js",
+ "main": "./src/index.js",
"matrix_src_main": "./src/index.js",
"matrix_lib_main": "./lib/index.js",
"matrix_lib_typings": "./lib/index.d.ts",
@@ -190,6 +190,5 @@
"transformIgnorePatterns": [
"/node_modules/(?!matrix-js-sdk).+$"
]
- },
- "typings": "./lib/index.d.ts"
+ }
}
From a696c09e1ec11c43312360def847e582971d9014 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Mon, 15 Mar 2021 14:47:08 +0000
Subject: [PATCH 44/49] 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 ab450f0526..f8b4287197 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,7 @@
"katex": "^0.12.0",
"linkifyjs": "^2.1.9",
"lodash": "^4.17.20",
- "matrix-js-sdk": "9.9.0",
+ "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
"matrix-widget-api": "^0.1.0-beta.13",
"minimist": "^1.2.5",
"pako": "^2.0.3",
diff --git a/yarn.lock b/yarn.lock
index 275c315921..58686248f7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5587,10 +5587,9 @@ mathml-tag-names@^2.1.3:
resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3"
integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==
-matrix-js-sdk@9.9.0:
+"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop":
version "9.9.0"
- resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-9.9.0.tgz#30c46419c026fcad0ff25aea9417b77921f64c6d"
- integrity sha512-rgy9b8D+GzjK3wfdmxDr42fxNV13fK12cvQD1qnsFzqPyJGeg++cazH/+7HxL/uuW/WQR6HAmfc7wo9VQegWtg==
+ resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/cd38fb9b4c349eb31feac14e806e710bf6431b72"
dependencies:
"@babel/runtime" "^7.12.5"
another-json "^0.2.0"
From 3154dd6cd441b7710a525e75512e1665adf60746 Mon Sep 17 00:00:00 2001
From: RiotRobot
Date: Mon, 15 Mar 2021 14:48:40 +0000
Subject: [PATCH 45/49] Add SDK version to changelog
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea4b015ee9..38b1a2572f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@ Changes in [3.16.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/
=====================================================================================================
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.16.0-rc.2...v3.16.0)
+ * Upgrade to JS SDK 9.9.0
* [Release] Change read receipt drift to be non-fractional
[\#5746](https://github.com/matrix-org/matrix-react-sdk/pull/5746)
* [Release] Properly gate SpaceRoomView behind labs
From f575625c7a5a5ec8984ae40aa5a97b3436249260 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20K=C3=B6sters?=
Date: Mon, 15 Mar 2021 23:13:16 +0100
Subject: [PATCH 46/49] fix: make room directory correct when using a
homeserver with explicit port
Server names are allowed to contain ':' to specify a port, see https://matrix.org/docs/spec/appendices#server-name
User ids on the other hand are not allowed to contain ':', even
historical user ids, see https://matrix.org/docs/spec/appendices#historical-user-ids
Therefore we can use change the regex to make sure the localpart is not
allowed to contain ':'.
---
src/MatrixClientPeg.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/MatrixClientPeg.ts b/src/MatrixClientPeg.ts
index 98ca446532..de1d573d40 100644
--- a/src/MatrixClientPeg.ts
+++ b/src/MatrixClientPeg.ts
@@ -261,7 +261,7 @@ class _MatrixClientPeg implements IMatrixClientPeg {
}
public getHomeserverName(): string {
- const matches = /^@.+:(.+)$/.exec(this.matrixClient.credentials.userId);
+ const matches = /^@[^:]+:(.+)$/.exec(this.matrixClient.credentials.userId);
if (matches === null || matches.length < 1) {
throw new Error("Failed to derive homeserver name from user ID!");
}
From 67e2ae99880aa2d45b6bcf8f1fb8d2b202153f7a Mon Sep 17 00:00:00 2001
From: David Baker
Date: Tue, 16 Mar 2021 15:42:03 +0000
Subject: [PATCH 47/49] Make some dispatches async
It looks like these dispatches were being dispatched while already
dispatching, causing soft crashes (although I can't see where the
first dispatch was from). Either way, seems like these didn't need
to be sync.
---
src/components/structures/LoggedInView.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx
index 15e90a383a..936eb819ba 100644
--- a/src/components/structures/LoggedInView.tsx
+++ b/src/components/structures/LoggedInView.tsx
@@ -240,10 +240,10 @@ class LoggedInView extends React.Component {
onCollapsed: (_collapsed) => {
collapsed = _collapsed;
if (_collapsed) {
- dis.dispatch({action: "hide_left_panel"}, true);
+ dis.dispatch({action: "hide_left_panel"});
window.localStorage.setItem("mx_lhs_size", '0');
} else {
- dis.dispatch({action: "show_left_panel"}, true);
+ dis.dispatch({action: "show_left_panel"});
}
},
onResized: (_size) => {
From 5ce3a05867e839eb41f66773899c176c3cbd80dc Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Tue, 16 Mar 2021 16:34:28 +0000
Subject: [PATCH 48/49] Update _SpacePanel.scss
---
res/css/structures/_SpacePanel.scss | 2 ++
1 file changed, 2 insertions(+)
diff --git a/res/css/structures/_SpacePanel.scss b/res/css/structures/_SpacePanel.scss
index afcf48ec4d..d3e7d7efee 100644
--- a/res/css/structures/_SpacePanel.scss
+++ b/res/css/structures/_SpacePanel.scss
@@ -147,6 +147,8 @@ $activeBorderColor: $secondary-fg-color;
.mx_SpaceButton_toggleCollapse {
width: $gutterSize;
+ // negative margin to place it correctly even with the complex
+ // 4px selection border each space button has when active
margin-right: -4px;
height: 20px;
mask-position: center;
From 451a3aaa3f6ccd7679c3bee5a57f2c6c0fb4fc62 Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Tue, 16 Mar 2021 13:50:43 -0600
Subject: [PATCH 49/49] Work around more cases where a rageshake server might
not be present
We already do this for a number of other places (slash commands, help section of settings, etc) - these places appear to have been missed, though.
---
.../views/dialogs/FeedbackDialog.js | 23 ++++++----
.../views/dialogs/RoomUpgradeWarningDialog.js | 42 ++++++++++++-------
src/i18n/strings/en_EN.json | 5 ++-
3 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/src/components/views/dialogs/FeedbackDialog.js b/src/components/views/dialogs/FeedbackDialog.js
index cbe26af6cc..d80a935573 100644
--- a/src/components/views/dialogs/FeedbackDialog.js
+++ b/src/components/views/dialogs/FeedbackDialog.js
@@ -100,6 +100,20 @@ export default (props) => {
);
}
+ let bugReports = null;
+ if (SdkConfig.get().bug_report_endpoint_url) {
+ bugReports = (
+
{
+ _t("PRO TIP: If you start a bug, please submit debug logs " +
+ "to help us track down the problem.", {}, {
+ debugLogsLink: sub => (
+ {sub}
+ ),
+ })
+ }
+ );
+ }
+
return ( {
},
})
}
-
{
- _t("PRO TIP: If you start a bug, please submit debug logs " +
- "to help us track down the problem.", {}, {
- debugLogsLink: sub => (
- {sub}
- ),
- })
- }
+ {bugReports}
{ countlyFeedbackSection }
}
diff --git a/src/components/views/dialogs/RoomUpgradeWarningDialog.js b/src/components/views/dialogs/RoomUpgradeWarningDialog.js
index 452ac56dff..c6ef2c6ae2 100644
--- a/src/components/views/dialogs/RoomUpgradeWarningDialog.js
+++ b/src/components/views/dialogs/RoomUpgradeWarningDialog.js
@@ -82,6 +82,33 @@ export default class RoomUpgradeWarningDialog extends React.Component {
const title = this.state.isPrivate ? _t("Upgrade private room") : _t("Upgrade public room");
+ let bugReports = (
+
+ {_t(
+ "This usually only affects how the room is processed on the server. If you're " +
+ "having problems with your %(brand)s, please report a bug.", {brand},
+ )}
+
+ {_t(
+ "This usually only affects how the room is processed on the server. If you're " +
+ "having problems with your %(brand)s, please report a bug.",
+ {
+ brand,
+ },
+ {
+ "a": (sub) => {
+ return {sub};
+ },
+ },
+ )}
+
+ );
+ }
+
return (
-
- {_t(
- "This usually only affects how the room is processed on the server. If you're " +
- "having problems with your %(brand)s, please report a bug.",
- {
- brand,
- },
- {
- "a": (sub) => {
- return {sub};
- },
- },
- )}
-
+ {bugReports}
{_t(
"You'll upgrade this room from to .",
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 63449eb99f..07d292a0e7 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -2150,10 +2150,10 @@
"Add comment": "Add comment",
"Comment": "Comment",
"There are two ways you can provide feedback and help us improve %(brand)s.": "There are two ways you can provide feedback and help us improve %(brand)s.",
+ "PRO TIP: If you start a bug, please submit debug logs to help us track down the problem.": "PRO TIP: If you start a bug, please submit debug logs to help us track down the problem.",
"Feedback": "Feedback",
"Report a bug": "Report a bug",
"Please view existing bugs on Github first. No match? Start a new one.": "Please view existing bugs on Github first. No match? Start a new one.",
- "PRO TIP: If you start a bug, please submit debug logs to help us track down the problem.": "PRO TIP: If you start a bug, please submit debug logs to help us track down the problem.",
"Send feedback": "Send feedback",
"Confirm abort of host creation": "Confirm abort of host creation",
"Are you sure you wish to abort creation of the host? The process cannot be continued.": "Are you sure you wish to abort creation of the host? The process cannot be continued.",
@@ -2269,8 +2269,9 @@
"Automatically invite users": "Automatically invite users",
"Upgrade private room": "Upgrade private room",
"Upgrade public room": "Upgrade public room",
- "Upgrading a room is an advanced action and is usually recommended when a room is unstable due to bugs, missing features or security vulnerabilities.": "Upgrading a room is an advanced action and is usually recommended when a room is unstable due to bugs, missing features or security vulnerabilities.",
+ "This usually only affects how the room is processed on the server. If you're having problems with your %(brand)s, please report a bug.": "This usually only affects how the room is processed on the server. If you're having problems with your %(brand)s, please report a bug.",
"This usually only affects how the room is processed on the server. If you're having problems with your %(brand)s, please report a bug.": "This usually only affects how the room is processed on the server. If you're having problems with your %(brand)s, please report a bug.",
+ "Upgrading a room is an advanced action and is usually recommended when a room is unstable due to bugs, missing features or security vulnerabilities.": "Upgrading a room is an advanced action and is usually recommended when a room is unstable due to bugs, missing features or security vulnerabilities.",
"You'll upgrade this room from to .": "You'll upgrade this room from to .",
"Resend": "Resend",
"You're all caught up.": "You're all caught up.",