From a4837d702ab0c44aa6669d662d3914f356a717cc Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 12 Sep 2019 15:59:15 +0200 Subject: [PATCH 01/41] dont wrap text in room directory buttons --- res/css/structures/_RoomDirectory.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/res/css/structures/_RoomDirectory.scss b/res/css/structures/_RoomDirectory.scss index 6b7a4ff0c7..4b49332af7 100644 --- a/res/css/structures/_RoomDirectory.scss +++ b/res/css/structures/_RoomDirectory.scss @@ -107,6 +107,7 @@ limitations under the License. .mx_RoomDirectory_join, .mx_RoomDirectory_preview { width: 80px; text-align: center; + white-space: nowrap; } .mx_RoomDirectory_name { From d64cd58e93c605fa96a3042d47eb7c5a0bedf076 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 12 Sep 2019 17:17:15 +0200 Subject: [PATCH 02/41] only hide x button when blurred && no more search term --- src/components/structures/SearchBox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/SearchBox.js b/src/components/structures/SearchBox.js index 007ac88db2..74dadbf2c4 100644 --- a/src/components/structures/SearchBox.js +++ b/src/components/structures/SearchBox.js @@ -125,7 +125,7 @@ module.exports = React.createClass({ if (this.props.collapsed) { return null; } - const clearButton = !this.state.blurred ? + const clearButton = (!this.state.blurred || this.state.searchTerm) ? ( {this._clearSearch("button"); } }> From a8df9956d962f9d09185c9f1201fd8d4c3116080 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Thu, 12 Sep 2019 18:37:13 +0100 Subject: [PATCH 03/41] Prepare changelog for v1.5.3-rc.1 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed52ca52a8..3c434dda0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Changes in [1.5.3-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.3-rc.1) (2019-09-12) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.2...v1.5.3-rc.1) + + * Fix: only hide clear filter button when blurred & no more search term + [\#3435](https://github.com/matrix-org/matrix-react-sdk/pull/3435) + * Dont wrap text in room directory buttons + [\#3434](https://github.com/matrix-org/matrix-react-sdk/pull/3434) + Changes in [1.5.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.2) (2019-09-12) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.2-rc.1...v1.5.2) From d394e76254b1cb8d730459bfe254d0630add8867 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Thu, 12 Sep 2019 18:37:13 +0100 Subject: [PATCH 04/41] v1.5.3-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 93e9f4ecc7..43a4659813 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.5.2", + "version": "1.5.3-rc.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 3fef6e6b22306b32604f1f05663cf755e66e6794 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 10 Sep 2019 08:26:10 +0100 Subject: [PATCH 05/41] Support Synapse deactivate on MemberInfo without Room (timeline pill) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/MemberInfo.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index 867e50ba0d..1b4c13db2c 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -637,7 +637,10 @@ module.exports = withMatrixClient(React.createClass({ _calculateOpsPermissions: async function(member) { const defaultPerms = { - can: {}, + can: { + // Calculate permissions for Synapse before doing the PL checks + synapseDeactivate: await this.context.matrixClient.isSynapseAdministrator(), + }, muted: false, }; const room = this.props.matrixClient.getRoom(member.roomId); @@ -651,9 +654,10 @@ module.exports = withMatrixClient(React.createClass({ const them = member; return { - can: await this._calculateCanPermissions( - me, them, powerLevels.getContent(), - ), + can: { + ...defaultPerms.can, + ...await this._calculateCanPermissions(me, them, powerLevels.getContent()), + }, muted: this._isMuted(them, powerLevels.getContent()), isTargetMod: them.powerLevel > powerLevels.getContent().users_default, }; @@ -670,9 +674,6 @@ module.exports = withMatrixClient(React.createClass({ redactMessages: false, }; - // Calculate permissions for Synapse before doing the PL checks - can.synapseDeactivate = await this.context.matrixClient.isSynapseAdministrator(); - const canAffectUser = them.powerLevel < me.powerLevel || isMe; if (!canAffectUser) { //console.log("Cannot affect user: %s >= %s", them.powerLevel, me.powerLevel); From f4ebde1596199761e7468eb570f6c7f2682859ec Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 12 Sep 2019 18:30:27 -0600 Subject: [PATCH 06/41] Wrap deactivation check with sanity conditions To ensure the matrixClient is not null (the problem) and that unexpected errors don't brick the app. Fixes https://github.com/vector-im/riot-web/issues/10854 --- src/components/views/rooms/MemberInfo.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index 1b4c13db2c..914e2df3d0 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -636,10 +636,19 @@ module.exports = withMatrixClient(React.createClass({ }, _calculateOpsPermissions: async function(member) { + let canDeactivate = false; + if (this.context.matrixClient) { + try { + canDeactivate = await this.context.matrixClient.isSynapseAdministrator(); + } catch (e) { + console.error(e); + } + } + const defaultPerms = { can: { // Calculate permissions for Synapse before doing the PL checks - synapseDeactivate: await this.context.matrixClient.isSynapseAdministrator(), + synapseDeactivate: canDeactivate, }, muted: false, }; From 820869d99b4b495fce7965f3857bf2a846980040 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 13 Sep 2019 11:09:02 +0200 Subject: [PATCH 07/41] fix clicking on room dir item --- src/components/structures/RoomDirectory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 19db128ba3..7c0b8e00e1 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -487,7 +487,7 @@ module.exports = React.createClass({ ); return ( this.onRoomClicked(room)} + onClick={(ev) => this.onRoomClicked(room, ev)} // cancel onMouseDown otherwise shift-clicking highlights text onMouseDown={(ev) => {ev.preventDefault();}} > From fc492904599acc896c7fe234953498341564107b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 8 Aug 2019 16:39:15 +0100 Subject: [PATCH 08/41] Add way to report the content of a message Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/context_menus/MessageContextMenu.js | 21 +++ .../views/dialogs/ReportEventDialog.js | 128 ++++++++++++++++++ src/i18n/strings/en_EN.json | 3 + 3 files changed, 152 insertions(+) create mode 100644 src/components/views/dialogs/ReportEventDialog.js diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index 04bc7c75ef..4b7b1f8545 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -1,6 +1,7 @@ /* Copyright 2015, 2016 OpenMarket Ltd Copyright 2018 New Vector Ltd +Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -116,6 +117,14 @@ module.exports = React.createClass({ this.closeMenu(); }, + onReportEventClick: function() { + const ReportEventDialog = sdk.getComponent("dialogs.ReportEventDialog"); + Modal.createTrackedDialog('Report Event', '', ReportEventDialog, { + mxEvent: this.props.mxEvent, + }, 'mx_Dialog_reportEvent'); + this.closeMenu(); + }, + onViewSourceClick: function() { const ViewSource = sdk.getComponent('structures.ViewSource'); Modal.createTrackedDialog('View Event Source', '', ViewSource, { @@ -278,6 +287,8 @@ module.exports = React.createClass({ }, render: function() { + const cli = MatrixClientPeg.get(); + const me = cli.getUserId(); const mxEvent = this.props.mxEvent; const eventStatus = mxEvent.status; const editStatus = mxEvent.replacingEvent() && mxEvent.replacingEvent().status; @@ -445,6 +456,15 @@ module.exports = React.createClass({ ; } + let reportEventButton; + if (mxEvent.getSender() !== me) { + reportEventButton = ( +
+ { _t('Report Content') } +
+ ); + } + return (
{ resendButton } @@ -463,6 +483,7 @@ module.exports = React.createClass({ { externalURLButton } { collapseReplyThread } { e2eInfo } + { reportEventButton }
); }, diff --git a/src/components/views/dialogs/ReportEventDialog.js b/src/components/views/dialogs/ReportEventDialog.js new file mode 100644 index 0000000000..b118084729 --- /dev/null +++ b/src/components/views/dialogs/ReportEventDialog.js @@ -0,0 +1,128 @@ +/* +Copyright 2019 Michael Telatynski <7t3chguy@gmail.com> + +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 React, {PureComponent} from 'react'; +import sdk from '../../../index'; +import { _t } from '../../../languageHandler'; +import PropTypes from "prop-types"; +import {MatrixEvent} from "matrix-js-sdk"; +import MatrixClientPeg from "../../../MatrixClientPeg"; + +/* + * A dialog for reporting an event. + */ +export default class ReportEventDialog extends PureComponent { + static propTypes = { + mxEvent: PropTypes.instanceOf(MatrixEvent).isRequired, + onFinished: PropTypes.func.isRequired, + }; + + constructor(props, context) { + super(props, context); + + this.state = { + reason: "", + busy: false, + err: null, + }; + } + + _onReasonChange = ({target: {value: reason}}) => { + this.setState({ reason }); + }; + + _onCancel = () => { + this.props.onFinished(false); + }; + + _onSubmit = async () => { + if (!this.state.reason || !this.state.reason.trim()) { + this.setState({ + err: _t("Please fill why you're reporting."), + }); + return; + } + + this.setState({ + busy: true, + err: null, + }); + + try { + const ev = this.props.mxEvent; + await MatrixClientPeg.get().reportEvent(ev.getRoomId(), ev.getId(), -100, this.state.reason.trim()); + this.props.onFinished(true); + } catch (e) { + this.setState({ + busy: false, + err: e.message, + }); + } + }; + + render() { + const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); + const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); + const Loader = sdk.getComponent('elements.Spinner'); + const Field = sdk.getComponent('elements.Field'); + + let error = null; + if (this.state.err) { + error =
+ {this.state.err} +
; + } + + let progress = null; + if (this.state.busy) { + progress = ( +
+ +
+ ); + } + + return ( + +
+ + {progress} + {error} +
+ +
+ ); + } +} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 90edd32660..f0fd0d1c15 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1225,6 +1225,9 @@ "To help avoid duplicate issues, please view existing issues first (and add a +1) or create a new issue if you can't find it.": "To help avoid duplicate issues, please view existing issues first (and add a +1) or create a new issue if you can't find it.", "Report bugs & give feedback": "Report bugs & give feedback", "Go back": "Go back", + "Please fill why you're reporting.": "Please fill why you're reporting.", + "Report Content": "Report Content", + "Send report": "Send report", "Room Settings - %(roomName)s": "Room Settings - %(roomName)s", "Failed to upgrade room": "Failed to upgrade room", "The room upgrade could not be completed": "The room upgrade could not be completed", From 92af11bce7e9e460d959a032f5ff5dfeb1aa27e2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 8 Aug 2019 16:47:16 +0100 Subject: [PATCH 09/41] fix indentation Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/dialogs/ReportEventDialog.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/views/dialogs/ReportEventDialog.js b/src/components/views/dialogs/ReportEventDialog.js index b118084729..ce7b83176e 100644 --- a/src/components/views/dialogs/ReportEventDialog.js +++ b/src/components/views/dialogs/ReportEventDialog.js @@ -116,11 +116,12 @@ export default class ReportEventDialog extends PureComponent { {progress} {error} - ); From c3d01715ff3af79693b15ce44eddc0c5c34b5741 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 12 Sep 2019 12:52:11 +0100 Subject: [PATCH 10/41] Improve ReportEventDialog as per PR feedback Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/dialogs/ReportEventDialog.js | 10 +++++++++- src/i18n/strings/en_EN.json | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/ReportEventDialog.js b/src/components/views/dialogs/ReportEventDialog.js index ce7b83176e..394e5ad47d 100644 --- a/src/components/views/dialogs/ReportEventDialog.js +++ b/src/components/views/dialogs/ReportEventDialog.js @@ -99,10 +99,18 @@ export default class ReportEventDialog extends PureComponent {
+

+ { + _t("Reporting this message will send its unique 'event ID' to the administrator of " + + "your homeserver. If messages in this room are encrypted, your homeserver " + + "administrator will not be able to read the message text or view any files or images.") + } +

+ Date: Fri, 13 Sep 2019 14:33:09 +0200 Subject: [PATCH 11/41] stop propagation click handler for doesn't run --- src/components/structures/RoomDirectory.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 7c0b8e00e1..7085461633 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -369,25 +369,27 @@ module.exports = React.createClass({ } }, - onPreviewClick: function(room) { + onPreviewClick: function(ev, room) { this.props.onFinished(); dis.dispatch({ action: 'view_room', room_id: room.room_id, should_peek: true, }); + ev.stopPropagation(); }, - onViewClick: function(room) { + onViewClick: function(ev, room) { this.props.onFinished(); dis.dispatch({ action: 'view_room', room_id: room.room_id, should_peek: false, }); + ev.stopPropagation(); }, - onJoinClick: function(room) { + onJoinClick: function(ev, room) { this.props.onFinished(); MatrixClientPeg.get().joinRoom(room.room_id); dis.dispatch({ @@ -395,6 +397,7 @@ module.exports = React.createClass({ room_id: room.room_id, joining: true, }); + ev.stopPropagation(); }, onCreateRoomClick: function(room) { @@ -458,16 +461,16 @@ module.exports = React.createClass({ if (room.world_readable && !hasJoinedRoom) { previewButton = ( - this.onPreviewClick(room)}>{_t("Preview")} + this.onPreviewClick(ev, room)}>{_t("Preview")} ); } if (hasJoinedRoom) { joinOrViewButton = ( - this.onViewClick(room)}>{_t("View")} + this.onViewClick(ev, room)}>{_t("View")} ); } else if (!isGuest || room.guest_can_join) { joinOrViewButton = ( - this.onJoinClick(room)}>{_t("Join")} + this.onJoinClick(ev, room)}>{_t("Join")} ); } From 3889917cba79768ad7d3eb111a23d0d40c99a98b Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 13 Sep 2019 14:23:38 +0100 Subject: [PATCH 12/41] Prepare changelog for v1.5.3-rc.2 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c434dda0f..1fd2b09702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +Changes in [1.5.3-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.3-rc.2) (2019-09-13) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.3-rc.1...v1.5.3-rc.2) + + * Fix: stop propagation click handler for doesn't run + [\#3443](https://github.com/matrix-org/matrix-react-sdk/pull/3443) + * Add way to report the content of a message + [\#3442](https://github.com/matrix-org/matrix-react-sdk/pull/3442) + * Fix synapse deactivate button for release + [\#3436](https://github.com/matrix-org/matrix-react-sdk/pull/3436) + * Fix: clicking on a room directory item takes you to the room + [\#3440](https://github.com/matrix-org/matrix-react-sdk/pull/3440) + Changes in [1.5.3-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.3-rc.1) (2019-09-12) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.2...v1.5.3-rc.1) From 63f75a36e4b824a74382451d0d422527bcc64c69 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 13 Sep 2019 14:23:39 +0100 Subject: [PATCH 13/41] v1.5.3-rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 43a4659813..1008da8736 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.5.3-rc.1", + "version": "1.5.3-rc.2", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 93d76cef369c14dd4dbe1f3e8f89cc06571b4c0c Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 13 Sep 2019 16:17:40 +0100 Subject: [PATCH 14/41] js-sdk rc.1 to get report API --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1008da8736..1440f0d963 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.17.14", "lolex": "2.3.2", - "matrix-js-sdk": "2.3.1", + "matrix-js-sdk": "2.3.2-rc.1", "optimist": "^0.6.1", "pako": "^1.0.5", "png-chunks-extract": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index b8abf285f8..213ee82cb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4958,10 +4958,10 @@ mathml-tag-names@^2.0.1: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.1.tgz#6dff66c99d55ecf739ca53c492e626f1d12a33cc" integrity sha512-pWB896KPGSGkp1XtyzRBftpTzwSOL0Gfk0wLvxt4f2mgzjY19o0LxJ3U25vNWTzsh7da+KTbuXQoQ3lOJZ8WHw== -matrix-js-sdk@2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.3.1.tgz#c0ebe90d43611cf28422317ec0c04f5d41acb2ad" - integrity sha512-lf2pGHp0o4bDVrSZ5ReLAkMMiX9PngGMxNAtzztdDvQ20lfYZvhwif9PUbi3tt8kwXlfs7s34eWxz5Rg37mdGg== +matrix-js-sdk@2.3.2-rc.1: + version "2.3.2-rc.1" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.3.2-rc.1.tgz#63cbe66724af3c664a50cdf914c4b3b170530e77" + integrity sha512-eMayAT9iZ7d+xaeCqLswpZfP7HIWpmjVT9tSaGbrV5/K3R03sStFeosutT3qY0UZsJofy4nbXgl/1arCBZ0iCA== dependencies: another-json "^0.2.0" babel-runtime "^6.26.0" From 195afab8fbbd438d8436759271b75a560cd50aa3 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 13 Sep 2019 16:21:15 +0100 Subject: [PATCH 15/41] Prepare changelog for v1.5.3-rc.3 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd2b09702..833110ef00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [1.5.3-rc.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.3-rc.3) (2019-09-13) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.3-rc.2...v1.5.3-rc.3) + + * js-sdk rc.1 for report API + Changes in [1.5.3-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.3-rc.2) (2019-09-13) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.3-rc.1...v1.5.3-rc.2) From 0556d34534227135dbafd2c04b3bc888cf928d6e Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 13 Sep 2019 16:21:15 +0100 Subject: [PATCH 16/41] v1.5.3-rc.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1440f0d963..732ba446a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.5.3-rc.2", + "version": "1.5.3-rc.3", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 54d98c22ba5019072f23b4938d9501b37fee5603 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 15 Sep 2019 21:25:36 +0100 Subject: [PATCH 17/41] Reuse showRoom for onJoinClick so we join using alias if its available Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomDirectory.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index f81c0c94c0..3c30e1d11e 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -390,12 +390,7 @@ module.exports = createReactClass({ onJoinClick: function(ev, room) { this.props.onFinished(); - MatrixClientPeg.get().joinRoom(room.room_id); - dis.dispatch({ - action: 'view_room', - room_id: room.room_id, - joining: true, - }); + this.showRoom(room, null, true); ev.stopPropagation(); }, From 7f5d38772d249d31e4ef0b3235ec9ab45cf90579 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 15 Sep 2019 21:30:01 +0100 Subject: [PATCH 18/41] don't fire onFinished twice Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomDirectory.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 3c30e1d11e..84f402e484 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -389,7 +389,6 @@ module.exports = createReactClass({ }, onJoinClick: function(ev, room) { - this.props.onFinished(); this.showRoom(room, null, true); ev.stopPropagation(); }, From 4fb4c5b74435f83b7e09f4b8185e1f05f0fd483e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 15 Sep 2019 22:19:07 +0100 Subject: [PATCH 19/41] Only put a room in Historical if === 'leave' not peeked Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/stores/RoomListStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index 6d41532852..f209f6f9ba 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -327,7 +327,7 @@ class RoomListStore extends Store { } else if (tags.length === 0) { tags.push("im.vector.fake.recent"); } - } else { + } else if (myMembership === 'leave') { tags.push("im.vector.fake.archived"); } From 3fdaeea3a237507cd289e952cd05a4598a0cb3ee Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 15 Sep 2019 22:24:23 +0100 Subject: [PATCH 20/41] allow rooms we were banned from into Historical also Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/stores/RoomListStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index f209f6f9ba..980753551a 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -327,7 +327,7 @@ class RoomListStore extends Store { } else if (tags.length === 0) { tags.push("im.vector.fake.recent"); } - } else if (myMembership === 'leave') { + } else if (myMembership) { // null-guard as null means it was peeked tags.push("im.vector.fake.archived"); } From 166364ba0325e2e762d7cbae06417f89ed5128bb Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 16 Sep 2019 10:12:15 +0200 Subject: [PATCH 21/41] Fix: make sure scalarUrls is never undefined --- src/utils/WidgetUtils.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/WidgetUtils.js b/src/utils/WidgetUtils.js index 06b4eed55b..237db82365 100644 --- a/src/utils/WidgetUtils.js +++ b/src/utils/WidgetUtils.js @@ -100,11 +100,14 @@ export default class WidgetUtils { } const testUrl = url.parse(testUrlString); - let scalarUrls = SdkConfig.get().integrations_widgets_urls; if (!scalarUrls || scalarUrls.length === 0) { const defaultManager = IntegrationManagers.sharedInstance().getPrimaryManager(); - if (defaultManager) scalarUrls = [defaultManager.apiUrl]; + if (defaultManager) { + scalarUrls = [defaultManager.apiUrl]; + } else { + scalarUrls = []; + } } for (let i = 0; i < scalarUrls.length; i++) { From 16a412e7d01f572dfed7743c7e82abf34f4cae09 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 16 Sep 2019 14:07:05 +0100 Subject: [PATCH 22/41] Tweak lock file to pull in only one React version Yarn deps can be a bit fiddly when targeting specific versions. This tweaks the lock file to only pull in a single React version. For others who may need to do something like this again, I recommend deleting specific package entries from `yarn.lock` and re-running `yarn install`. That should make it pick the right thing while also leaving other packages as they were. --- yarn.lock | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/yarn.lock b/yarn.lock index 77abb011a5..c9f174eb34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6379,17 +6379,7 @@ react-beautiful-dnd@^4.0.1: redux-thunk "^2.2.0" reselect "^3.0.1" -react-dom@^16.4.2: - version "16.8.6" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f" - integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.2" - scheduler "^0.13.6" - -react-dom@^16.9.0: +react-dom@^16.4.2, react-dom@^16.9.0: version "16.9.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.9.0.tgz#5e65527a5e26f22ae3701131bcccaee9fb0d3962" integrity sha512-YFT2rxO9hM70ewk9jq0y6sQk8cL02xm4+IzYBz75CQGlClQQ1Bxq0nhHF6OtSbit+AIahujJgb/CPRibFkMNJQ== @@ -6453,17 +6443,7 @@ react-transition-group@^1.2.0: prop-types "^15.5.6" warning "^3.0.0" -react@^16.4.2: - version "16.8.6" - resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe" - integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.2" - scheduler "^0.13.6" - -react@^16.9.0: +react@^16.4.2, react@^16.9.0: version "16.9.0" resolved "https://registry.yarnpkg.com/react/-/react-16.9.0.tgz#40ba2f9af13bc1a38d75dbf2f4359a5185c4f7aa" integrity sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w== @@ -6916,14 +6896,6 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -scheduler@^0.13.6: - version "0.13.6" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.6.tgz#466a4ec332467b31a91b9bf74e5347072e4cd889" - integrity sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - scheduler@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.15.0.tgz#6bfcf80ff850b280fed4aeecc6513bc0b4f17f8e" From 597433d549a5fbcc59cfd1ee7d067c78e29daf34 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 15 Sep 2019 21:25:36 +0100 Subject: [PATCH 23/41] Reuse showRoom for onJoinClick so we join using alias if its available Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomDirectory.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 7085461633..e3ba8f969f 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -391,12 +391,7 @@ module.exports = React.createClass({ onJoinClick: function(ev, room) { this.props.onFinished(); - MatrixClientPeg.get().joinRoom(room.room_id); - dis.dispatch({ - action: 'view_room', - room_id: room.room_id, - joining: true, - }); + this.showRoom(room, null, true); ev.stopPropagation(); }, From 5d1056e1ef2f97e9e86f383174f32f9f3e221739 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 15 Sep 2019 21:30:01 +0100 Subject: [PATCH 24/41] don't fire onFinished twice Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomDirectory.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index e3ba8f969f..332ea5e731 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -390,7 +390,6 @@ module.exports = React.createClass({ }, onJoinClick: function(ev, room) { - this.props.onFinished(); this.showRoom(room, null, true); ev.stopPropagation(); }, From 44cf99d5d47ae9096dfc7d344c3aa20051ee5d37 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 16 Sep 2019 17:44:16 +0100 Subject: [PATCH 25/41] released js-sdk --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 732ba446a9..2149193a4a 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.17.14", "lolex": "2.3.2", - "matrix-js-sdk": "2.3.2-rc.1", + "matrix-js-sdk": "2.3.2", "optimist": "^0.6.1", "pako": "^1.0.5", "png-chunks-extract": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index 213ee82cb6..19782941f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4958,10 +4958,10 @@ mathml-tag-names@^2.0.1: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.1.tgz#6dff66c99d55ecf739ca53c492e626f1d12a33cc" integrity sha512-pWB896KPGSGkp1XtyzRBftpTzwSOL0Gfk0wLvxt4f2mgzjY19o0LxJ3U25vNWTzsh7da+KTbuXQoQ3lOJZ8WHw== -matrix-js-sdk@2.3.2-rc.1: - version "2.3.2-rc.1" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.3.2-rc.1.tgz#63cbe66724af3c664a50cdf914c4b3b170530e77" - integrity sha512-eMayAT9iZ7d+xaeCqLswpZfP7HIWpmjVT9tSaGbrV5/K3R03sStFeosutT3qY0UZsJofy4nbXgl/1arCBZ0iCA== +matrix-js-sdk@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.3.2.tgz#341491e8396edbfe93cd034bce34acc6841af322" + integrity sha512-sWSqIvB0qEQgl3hPXLvhL0QPyH8161i37266yb6IAkprsJj4n0V/fiwzPd6Oft3Rv8ti4hBqsLN93dzYDPcupA== dependencies: another-json "^0.2.0" babel-runtime "^6.26.0" From a1b13e51a0313d2fef00ceb63511acd553549780 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 16 Sep 2019 17:47:22 +0100 Subject: [PATCH 26/41] Prepare changelog for v1.5.3 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 833110ef00..ef4f4203f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +Changes in [1.5.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.3) (2019-09-16) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.3-rc.3...v1.5.3) + + * Release: Directory should use the alias or server information to join the + room + [\#3448](https://github.com/matrix-org/matrix-react-sdk/pull/3448) + Changes in [1.5.3-rc.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.5.3-rc.3) (2019-09-13) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.5.3-rc.2...v1.5.3-rc.3) From 74cbdf28edc09b2fc1ff2db678ee95391b2a2b08 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Mon, 16 Sep 2019 17:47:22 +0100 Subject: [PATCH 27/41] v1.5.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2149193a4a..1ad85e034a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.5.3-rc.3", + "version": "1.5.3", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 4e42dbe4188eba9ecaad8ae0d64e325d10e69e16 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 17 Sep 2019 14:56:55 +0100 Subject: [PATCH 28/41] Fix address type props to state conversion The address picker recently started tracking props and state versions of valid address types separately (https://github.com/matrix-org/matrix-react-sdk/pull/3408), where props represents the maximal set of possible types and the state is the current available types right now (since it can change while the dialog is open). For the case where there is no a IS, a regression was introduced by that PR by mutating the props in place instead returning a modified copy for the state. Regressed by https://github.com/matrix-org/matrix-react-sdk/pull/3408 Fixes https://github.com/vector-im/riot-web/issues/10878 --- src/components/views/dialogs/AddressPickerDialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/dialogs/AddressPickerDialog.js b/src/components/views/dialogs/AddressPickerDialog.js index 32c5cf6900..1eac07dbfd 100644 --- a/src/components/views/dialogs/AddressPickerDialog.js +++ b/src/components/views/dialogs/AddressPickerDialog.js @@ -80,7 +80,7 @@ module.exports = createReactClass({ let validAddressTypes = this.props.validAddressTypes; // Remove email from validAddressTypes if no IS is configured. It may be added at a later stage by the user if (!MatrixClientPeg.get().getIdentityServerUrl() && validAddressTypes.includes("email")) { - validAddressTypes = validAddressTypes.splice(validAddressTypes.indexOf("email"), 1); + validAddressTypes = validAddressTypes.filter(type => type !== "email"); } return { From 832123524d27bbf8c641f9bd3e99964b2be764c0 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 17 Sep 2019 17:34:30 +0100 Subject: [PATCH 29/41] make the lifetimes of the RM configurable --- src/components/structures/TimelinePanel.js | 12 +++++--- .../tabs/user/PreferencesUserSettingsTab.js | 29 ++++++++++++++++++- src/i18n/strings/en_EN.json | 4 ++- src/settings/Settings.js | 8 +++++ 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 0ca1cb9996..faa6f2564a 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -42,8 +42,6 @@ import EditorStateTransfer from '../../utils/EditorStateTransfer'; const PAGINATE_SIZE = 20; const INITIAL_SIZE = 20; -const READ_MARKER_INVIEW_THRESHOLD_MS = 1 * 1000; -const READ_MARKER_OUTOFVIEW_THRESHOLD_MS = 30 * 1000; const READ_RECEIPT_INTERVAL_MS = 500; const DEBUG = false; @@ -191,6 +189,12 @@ const TimelinePanel = createReactClass({ // always show timestamps on event tiles? alwaysShowTimestamps: SettingsStore.getValue("alwaysShowTimestamps"), + + // how long to show the RM for when it's visible in the window + readMarkerInViewThresholdMs: SettingsStore.getValue("readMarkerInViewThresholdMs"), + + // how long to show the RM for when it's scrolled off-screen + readMarkerOutOfViewThresholdMs: SettingsStore.getValue("readMarkerOutOfViewThresholdMs"), }; }, @@ -593,8 +597,8 @@ const TimelinePanel = createReactClass({ _readMarkerTimeout(readMarkerPosition) { return readMarkerPosition === 0 ? - READ_MARKER_INVIEW_THRESHOLD_MS : - READ_MARKER_OUTOFVIEW_THRESHOLD_MS; + this.state.readMarkerInViewThresholdMs : + this.state.readMarkerOutOfViewThresholdMs; }, updateReadMarkerOnUserActivity: async function() { diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js index 6507854e59..6528c86f19 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js @@ -69,7 +69,12 @@ export default class PreferencesUserSettingsTab extends React.Component { alwaysShowMenuBarSupported: false, minimizeToTray: true, minimizeToTraySupported: false, - autocompleteDelay: SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10), + autocompleteDelay: + SettingsStore.getValueAt(SettingLevel.DEVICE, 'autocompleteDelay').toString(10), + readMarkerInViewThresholdMs: + SettingsStore.getValueAt(SettingLevel.DEVICE, 'readMarkerInViewThresholdMs').toString(10), + readMarkerOutOfViewThresholdMs: + SettingsStore.getValueAt(SettingLevel.DEVICE, 'readMarkerOutOfViewThresholdMs').toString(10), }; } @@ -124,6 +129,16 @@ export default class PreferencesUserSettingsTab extends React.Component { SettingsStore.setValue("autocompleteDelay", null, SettingLevel.DEVICE, e.target.value); }; + _onReadMarkerInViewThresholdMs = (e) => { + this.setState({readMarkerInViewThresholdMs: e.target.value}); + SettingsStore.setValue("readMarkerInViewThresholdMs", null, SettingLevel.DEVICE, e.target.value); + }; + + _onReadMarkerOutOfViewThresholdMs = (e) => { + this.setState({readMarkerOutOfViewThresholdMs: e.target.value}); + SettingsStore.setValue("readMarkerOutOfViewThresholdMs", null, SettingLevel.DEVICE, e.target.value); + }; + _renderGroup(settingIds) { const SettingsFlag = sdk.getComponent("views.elements.SettingsFlag"); return settingIds.map(i => ); @@ -178,6 +193,18 @@ export default class PreferencesUserSettingsTab extends React.Component { type='number' value={this.state.autocompleteDelay} onChange={this._onAutocompleteDelayChange} /> + +
); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 32f4569a3a..8100c58658 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1796,5 +1796,7 @@ "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.": "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.", "Failed to set direct chat tag": "Failed to set direct chat tag", "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", - "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room" + "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", + "Read Marker lifetime (ms)": "Read Marker lifetime (ms)", + "Read Marker off-screen lifetime (ms)": "Read Marker off-screen lifetime (ms)", } diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 7b049208aa..e0ff16c538 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -284,6 +284,14 @@ export const SETTINGS = { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, default: 200, }, + "readMarkerInViewThresholdMs": { + supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, + default: 3000, + }, + "readMarkerOutOfViewThresholdMs": { + supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, + default: 30000, + }, "blacklistUnverifiedDevices": { // We specifically want to have room-device > device so that users may set a device default // with a per-room override. From b2f44237b83c01861a7476c091377b928a9a7bbf Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 17 Sep 2019 17:36:29 +0100 Subject: [PATCH 30/41] dangling comma --- src/i18n/strings/en_EN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 8100c58658..977d516fe4 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1798,5 +1798,5 @@ "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", "Read Marker lifetime (ms)": "Read Marker lifetime (ms)", - "Read Marker off-screen lifetime (ms)": "Read Marker off-screen lifetime (ms)", + "Read Marker off-screen lifetime (ms)": "Read Marker off-screen lifetime (ms)" } From 11c7d02a2db77651d819dfc592148b2c357d21fe Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 17 Sep 2019 10:44:29 -0600 Subject: [PATCH 31/41] Point to develop dependencies and fixed react-gemini-scrollbar Fixes https://github.com/vector-im/riot-web/issues/10894 See https://github.com/matrix-org/react-gemini-scrollbar/pull/3 --- package.json | 4 ++-- yarn.lock | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 3a7343d8a1..57e63e1055 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.17.14", "lolex": "2.3.2", - "matrix-js-sdk": "2.3.2", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "optimist": "^0.6.1", "pako": "^1.0.5", "png-chunks-extract": "^1.0.0", @@ -97,7 +97,7 @@ "react-addons-css-transition-group": "15.6.2", "react-beautiful-dnd": "^4.0.1", "react-dom": "^16.9.0", - "react-gemini-scrollbar": "github:matrix-org/react-gemini-scrollbar#f644523", + "react-gemini-scrollbar": "github:matrix-org/react-gemini-scrollbar#d3a2b21", "resize-observer-polyfill": "^1.5.0", "sanitize-html": "^1.18.4", "slate": "^0.41.2", diff --git a/yarn.lock b/yarn.lock index 95ac5db8b8..d6591c9206 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5049,10 +5049,9 @@ mathml-tag-names@^2.0.1: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.1.tgz#6dff66c99d55ecf739ca53c492e626f1d12a33cc" integrity sha512-pWB896KPGSGkp1XtyzRBftpTzwSOL0Gfk0wLvxt4f2mgzjY19o0LxJ3U25vNWTzsh7da+KTbuXQoQ3lOJZ8WHw== -matrix-js-sdk@2.3.2: +"matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "2.3.2" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.3.2.tgz#341491e8396edbfe93cd034bce34acc6841af322" - integrity sha512-sWSqIvB0qEQgl3hPXLvhL0QPyH8161i37266yb6IAkprsJj4n0V/fiwzPd6Oft3Rv8ti4hBqsLN93dzYDPcupA== + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/55b4595bbf52cdbf91edd7d326f72aabd6709dac" dependencies: another-json "^0.2.0" babel-runtime "^6.26.0" @@ -6389,9 +6388,9 @@ react-dom@^16.4.2, react-dom@^16.9.0: prop-types "^15.6.2" scheduler "^0.15.0" -"react-gemini-scrollbar@github:matrix-org/react-gemini-scrollbar#f644523": +"react-gemini-scrollbar@github:matrix-org/react-gemini-scrollbar#d3a2b21": version "2.1.5" - resolved "https://codeload.github.com/matrix-org/react-gemini-scrollbar/tar.gz/f64452388011d37d8a4427ba769153c30700ab8c" + resolved "https://codeload.github.com/matrix-org/react-gemini-scrollbar/tar.gz/d3a2b211016dd1af689341a6a2d348757b842f6b" dependencies: gemini-scrollbar matrix-org/gemini-scrollbar#91e1e566 From 90691ada3c52925edf4c51a53e5aad825ce8b65a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 17 Sep 2019 17:51:03 +0100 Subject: [PATCH 32/41] normalise translations --- 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 977d516fe4..f55eff0aff 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -636,6 +636,8 @@ "Timeline": "Timeline", "Room list": "Room list", "Autocomplete delay (ms)": "Autocomplete delay (ms)", + "Read Marker lifetime (ms)": "Read Marker lifetime (ms)", + "Read Marker off-screen lifetime (ms)": "Read Marker off-screen lifetime (ms)", "Unignore": "Unignore", "": "", "Import E2E room keys": "Import E2E room keys", @@ -1796,7 +1798,5 @@ "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.": "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.", "Failed to set direct chat tag": "Failed to set direct chat tag", "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", - "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", - "Read Marker lifetime (ms)": "Read Marker lifetime (ms)", - "Read Marker off-screen lifetime (ms)": "Read Marker off-screen lifetime (ms)" + "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room" } From 9c474da831365c9f8283ade86ff9bad9168e717f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 17 Sep 2019 10:55:49 -0600 Subject: [PATCH 33/41] Bump to master commit of react-gemini-scrollbar --- package.json | 2 +- yarn.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 57e63e1055..070abf352d 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "react-addons-css-transition-group": "15.6.2", "react-beautiful-dnd": "^4.0.1", "react-dom": "^16.9.0", - "react-gemini-scrollbar": "github:matrix-org/react-gemini-scrollbar#d3a2b21", + "react-gemini-scrollbar": "github:matrix-org/react-gemini-scrollbar#9cf17f63b7c0b0ec5f31df27da0f82f7238dc594", "resize-observer-polyfill": "^1.5.0", "sanitize-html": "^1.18.4", "slate": "^0.41.2", diff --git a/yarn.lock b/yarn.lock index d6591c9206..712de0b2b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6388,9 +6388,9 @@ react-dom@^16.4.2, react-dom@^16.9.0: prop-types "^15.6.2" scheduler "^0.15.0" -"react-gemini-scrollbar@github:matrix-org/react-gemini-scrollbar#d3a2b21": +"react-gemini-scrollbar@github:matrix-org/react-gemini-scrollbar#9cf17f63b7c0b0ec5f31df27da0f82f7238dc594": version "2.1.5" - resolved "https://codeload.github.com/matrix-org/react-gemini-scrollbar/tar.gz/d3a2b211016dd1af689341a6a2d348757b842f6b" + resolved "https://codeload.github.com/matrix-org/react-gemini-scrollbar/tar.gz/9cf17f63b7c0b0ec5f31df27da0f82f7238dc594" dependencies: gemini-scrollbar matrix-org/gemini-scrollbar#91e1e566 From 99b8193ce7a33f26ae08667d354f26ed1ef2f3dd Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 17 Sep 2019 14:33:32 -0600 Subject: [PATCH 34/41] Use the new ShallowRenderer over ReactTestUtils Mostly because the ReactTestUtils renderer doesn't exist anymore. --- package.json | 1 + .../views/elements/MemberEventListSummary-test.js | 4 ++-- test/test-utils.js | 5 +++++ yarn.lock | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 070abf352d..0e41d4c38a 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,7 @@ "matrix-mock-request": "^1.2.3", "matrix-react-test-utils": "^0.2.2", "mocha": "^5.0.5", + "react-test-renderer": "^16.9.0", "require-json": "0.0.1", "rimraf": "^2.4.3", "sinon": "^5.0.7", diff --git a/test/components/views/elements/MemberEventListSummary-test.js b/test/components/views/elements/MemberEventListSummary-test.js index d1e112735d..09a4739f06 100644 --- a/test/components/views/elements/MemberEventListSummary-test.js +++ b/test/components/views/elements/MemberEventListSummary-test.js @@ -112,7 +112,7 @@ describe('MemberEventListSummary', function() { threshold: 3, }; - const renderer = ReactTestUtils.createRenderer(); + const renderer = testUtils.getRenderer(); renderer.render(); const result = renderer.getRenderOutput(); @@ -134,7 +134,7 @@ describe('MemberEventListSummary', function() { threshold: 3, }; - const renderer = ReactTestUtils.createRenderer(); + const renderer = testUtils.getRenderer(); renderer.render(); const result = renderer.getRenderOutput(); diff --git a/test/test-utils.js b/test/test-utils.js index f60cab3bc2..ff800132b9 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -9,6 +9,7 @@ import dis from '../src/dispatcher'; import jssdk from 'matrix-js-sdk'; import {makeType} from "../src/utils/TypeUtils"; import {ValidatedServerConfig} from "../src/utils/AutoDiscoveryUtils"; +import ShallowRenderer from 'react-test-renderer/shallow'; const MatrixEvent = jssdk.MatrixEvent; /** @@ -31,6 +32,10 @@ export function beforeEach(context) { console.log(new Array(1 + desc.length).join("=")); } +export function getRenderer() { + // Old: ReactTestUtils.createRenderer(); + return new ShallowRenderer(); +} /** * Stub out the MatrixClient, and configure the MatrixClientPeg object to diff --git a/yarn.lock b/yarn.lock index 712de0b2b4..4789b22041 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6404,6 +6404,11 @@ react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== +react-is@^16.9.0: + version "16.9.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" + integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== + react-lifecycles-compat@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" @@ -6431,6 +6436,16 @@ react-redux@^5.0.6: react-is "^16.6.0" react-lifecycles-compat "^3.0.0" +react-test-renderer@^16.9.0: + version "16.9.0" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.9.0.tgz#7ed657a374af47af88f66f33a3ef99c9610c8ae9" + integrity sha512-R62stB73qZyhrJo7wmCW9jgl/07ai+YzvouvCXIJLBkRlRqLx4j9RqcLEAfNfU3OxTGucqR2Whmn3/Aad6L3hQ== + dependencies: + object-assign "^4.1.1" + prop-types "^15.6.2" + react-is "^16.9.0" + scheduler "^0.15.0" + react-transition-group@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-1.2.1.tgz#e11f72b257f921b213229a774df46612346c7ca6" From 10b2501785ca27e193399696f03538e5ead35b7a Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 17 Sep 2019 14:37:59 -0600 Subject: [PATCH 35/41] Upgrade lolex to pull in a clock fix See https://github.com/sinonjs/lolex/issues/136 We don't use fake timers, but we do use lolex's clock, which probably causes the same thing. Jumping from 2.x to 4.x looks largely compatible - tests pass. --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0e41d4c38a..958b782ac3 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "isomorphic-fetch": "^2.2.1", "linkifyjs": "^2.1.6", "lodash": "^4.17.14", - "lolex": "2.3.2", + "lolex": "4.2", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "optimist": "^0.6.1", "pako": "^1.0.5", diff --git a/yarn.lock b/yarn.lock index 4789b22041..ac1adf1d20 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4930,10 +4930,10 @@ loglevel@1.6.1: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa" integrity sha1-4PyVEztu8nbNyIh82vJKpvFW+Po= -lolex@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.3.2.tgz#85f9450425103bf9e7a60668ea25dc43274ca807" - integrity sha512-A5pN2tkFj7H0dGIAM6MFvHKMJcPnjZsOMvR7ujCjfgW5TbV6H9vb1PgxLtHvjqNZTHsUolz+6/WEO0N1xNx2ng== +lolex@4.2: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-4.2.0.tgz#ddbd7f6213ca1ea5826901ab1222b65d714b3cd7" + integrity sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg== lolex@^2.4.2: version "2.7.5" From 9f3f88ba00faf25a754f6939818e1cb8e42cadde Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 17 Sep 2019 15:41:39 -0600 Subject: [PATCH 36/41] Focus context menus so screen readers can find them Fixes https://github.com/vector-im/riot-web/issues/10899 The `tabIndex` is required to make the thing actually focusable. This is the same trick employed in https://github.com/matrix-org/matrix-react-sdk/pull/2994 --- src/components/structures/ContextualMenu.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/structures/ContextualMenu.js b/src/components/structures/ContextualMenu.js index 3ce52247d9..27a202785b 100644 --- a/src/components/structures/ContextualMenu.js +++ b/src/components/structures/ContextualMenu.js @@ -20,6 +20,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import classNames from 'classnames'; +import {focusCapturedRef} from "../../utils/Accessibility"; // Shamelessly ripped off Modal.js. There's probably a better way // of doing reusable widgets like dialog boxes & menus where we go and @@ -83,6 +84,9 @@ export default class ContextualMenu extends React.Component { // We don't need to clean up when unmounting, so ignore if (!element) return; + // For screen readers to find the thing + focusCapturedRef(element); + this.setState({ contextMenuRect: element.getBoundingClientRect(), }); @@ -206,7 +210,7 @@ export default class ContextualMenu extends React.Component { // FIXME: If a menu uses getDefaultProps it clobbers the onFinished // property set here so you can't close the menu from a button click! return
-
+
{ chevron }
From 648527e6505f8028ac019dd56e67630710f025b6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 18 Sep 2019 08:41:05 +0100 Subject: [PATCH 37/41] Fix failure to render newly verified phone number and nested forms Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/settings/account/PhoneNumbers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/settings/account/PhoneNumbers.js b/src/components/views/settings/account/PhoneNumbers.js index 8f91eb22cc..f814561c97 100644 --- a/src/components/views/settings/account/PhoneNumbers.js +++ b/src/components/views/settings/account/PhoneNumbers.js @@ -176,6 +176,7 @@ export default class PhoneNumbers extends React.Component { this.setState({continueDisabled: true}); const token = this.state.newPhoneNumberCode; + const address = this.state.verifyMsisdn; this.state.addTask.haveMsisdnToken(token).then(() => { this.setState({ addTask: null, @@ -188,7 +189,7 @@ export default class PhoneNumbers extends React.Component { }); const msisdns = [ ...this.props.msisdns, - { address: this.state.verifyMsisdn, medium: "msisdn" }, + { address, medium: "msisdn" }, ]; this.props.onMsisdnsChange(msisdns); }).catch((err) => { @@ -272,8 +273,8 @@ export default class PhoneNumbers extends React.Component { onChange={this._onChangeNewPhoneNumber} />
- {addVerifySection} + {addVerifySection}
); } From 54ea85f235755d2b4b9833dcbdf66833fd4d1c04 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 18 Sep 2019 09:12:23 +0100 Subject: [PATCH 38/41] regenerate .eslintignore.errorfiles Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .eslintignore.errorfiles | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index 02629ea169..ba53b59717 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -1,8 +1,6 @@ # autogenerated file: run scripts/generate-eslint-error-ignore-file to update. src/component-index.js -src/components/structures/BottomLeftMenu.js -src/components/structures/CreateRoom.js src/components/structures/RoomDirectory.js src/components/structures/RoomStatusBar.js src/components/structures/RoomView.js @@ -18,36 +16,28 @@ src/components/views/dialogs/UnknownDeviceDialog.js src/components/views/elements/AddressSelector.js src/components/views/elements/DirectorySearchBox.js src/components/views/elements/MemberEventListSummary.js -src/components/views/elements/TintableSvg.js src/components/views/elements/UserSelector.js src/components/views/globals/MatrixToolbar.js src/components/views/globals/NewVersionBar.js src/components/views/globals/UpdateCheckBar.js src/components/views/messages/MFileBody.js -src/components/views/messages/RoomAvatarEvent.js src/components/views/messages/TextualBody.js src/components/views/room_settings/ColorSettings.js src/components/views/rooms/Autocomplete.js src/components/views/rooms/AuxPanel.js -src/components/views/rooms/EntityTile.js src/components/views/rooms/LinkPreviewWidget.js src/components/views/rooms/MemberDeviceInfo.js src/components/views/rooms/MemberInfo.js src/components/views/rooms/MemberList.js -src/components/views/rooms/SlateMessageComposer.js -src/components/views/rooms/PinnedEventTile.js src/components/views/rooms/RoomList.js src/components/views/rooms/RoomPreviewBar.js -src/components/views/rooms/SearchableEntityList.js src/components/views/rooms/SearchBar.js src/components/views/rooms/SearchResultTile.js -src/components/views/rooms/TopUnreadMessagesBar.js -src/components/views/rooms/UserTile.js +src/components/views/rooms/SlateMessageComposer.js src/components/views/settings/ChangeAvatar.js src/components/views/settings/ChangePassword.js src/components/views/settings/DevicesPanel.js src/components/views/settings/Notifications.js -src/GroupAddressPicker.js src/HtmlUtils.js src/ImageUtils.js src/linkify-matrix.js @@ -55,7 +45,6 @@ src/Markdown.js src/MatrixClientPeg.js src/notifications/ContentRules.js src/notifications/PushRuleVectorState.js -src/notifications/VectorPushRulesDefinitions.js src/Notifier.js src/PlatformPeg.js src/Presence.js @@ -64,7 +53,6 @@ src/rageshake/submit-rageshake.js src/ratelimitedfunc.js src/Roles.js src/Rooms.js -src/UiEffects.js src/Unread.js src/utils/DecryptFile.js src/utils/DirectoryUtils.js @@ -75,13 +63,9 @@ src/utils/Receipt.js src/VectorConferenceHandler.js src/Velociraptor.js src/WhoIsTyping.js -src/wrappers/withMatrixClient.js test/components/structures/MessagePanel-test.js -test/components/structures/ScrollPanel-test.js -test/components/structures/TimelinePanel-test.js test/components/views/dialogs/InteractiveAuthDialog-test.js test/components/views/rooms/MessageComposerInput-test.js -test/components/views/rooms/RoomSettings-test.js test/mock-clock.js test/notifications/ContentRules-test.js test/notifications/PushRuleVectorState-test.js From e502558f7d5f450165d02106ba7808118160c448 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 18 Sep 2019 09:27:43 +0100 Subject: [PATCH 39/41] Delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .eslintignore.errorfiles | 7 ------- src/MatrixClientPeg.js | 15 ++++++--------- src/Notifier.js | 5 +++-- src/Presence.js | 13 ++++++------- src/Roles.js | 2 +- src/VectorConferenceHandler.js | 12 +++++------- src/WhoIsTyping.js | 16 +++++++++++----- src/linkify-matrix.js | 28 ++++++++++++++-------------- 8 files changed, 46 insertions(+), 52 deletions(-) diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index ba53b59717..7d998f8c4b 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -40,18 +40,13 @@ src/components/views/settings/DevicesPanel.js src/components/views/settings/Notifications.js src/HtmlUtils.js src/ImageUtils.js -src/linkify-matrix.js src/Markdown.js -src/MatrixClientPeg.js src/notifications/ContentRules.js src/notifications/PushRuleVectorState.js -src/Notifier.js src/PlatformPeg.js -src/Presence.js src/rageshake/rageshake.js src/rageshake/submit-rageshake.js src/ratelimitedfunc.js -src/Roles.js src/Rooms.js src/Unread.js src/utils/DecryptFile.js @@ -60,9 +55,7 @@ src/utils/DMRoomMap.js src/utils/FormattingUtils.js src/utils/MultiInviter.js src/utils/Receipt.js -src/VectorConferenceHandler.js src/Velociraptor.js -src/WhoIsTyping.js test/components/structures/MessagePanel-test.js test/components/views/dialogs/InteractiveAuthDialog-test.js test/components/views/rooms/MessageComposerInput-test.js diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 27c4f40669..bebb254afc 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -16,9 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; - -import Matrix from 'matrix-js-sdk'; +import {MatrixClient, MemoryStore} from 'matrix-js-sdk'; import utils from 'matrix-js-sdk/lib/utils'; import EventTimeline from 'matrix-js-sdk/lib/models/event-timeline'; @@ -27,7 +25,6 @@ import sdk from './index'; import createMatrixClient from './utils/createMatrixClient'; import SettingsStore from './settings/SettingsStore'; import MatrixActionCreators from './actions/MatrixActionCreators'; -import {phasedRollOutExpiredForUser} from "./PhasedRollOut"; import Modal from './Modal'; import {verificationMethods} from 'matrix-js-sdk/lib/crypto'; import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler"; @@ -87,7 +84,7 @@ class MatrixClientPeg { MatrixActionCreators.stop(); } - /* + /** * If we've registered a user ID we set this to the ID of the * user we've just registered. If they then go & log in, we * can send them to the welcome user (obviously this doesn't @@ -99,7 +96,7 @@ class MatrixClientPeg { this._justRegisteredUserId = uid; } - /* + /** * Returns true if the current user has just been registered by this * client as determined by setJustRegisteredUserId() * @@ -112,7 +109,7 @@ class MatrixClientPeg { ); } - /** + /* * Replace this MatrixClientPeg's client with a client instance that has * homeserver / identity server URLs and active credentials */ @@ -131,7 +128,7 @@ class MatrixClientPeg { } catch (err) { if (dbType === 'indexeddb') { console.error('Error starting matrixclient store - falling back to memory store', err); - this.matrixClient.store = new Matrix.MemoryStore({ + this.matrixClient.store = new MemoryStore({ localStorage: global.localStorage, }); } else { @@ -195,7 +192,7 @@ class MatrixClientPeg { }; } - /** + /* * Return the server name of the user's homeserver * Throws an error if unable to deduce the homeserver name * (eg. if the user is not logged in) diff --git a/src/Notifier.js b/src/Notifier.js index 0b0a5f6990..cca0ea2b89 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -112,7 +112,7 @@ const Notifier = { console.warn(`${roomId} has custom notification sound event, but no url key`); return null; } - + if (!content.url.startsWith("mxc://")) { console.warn(`${roomId} has custom notification sound event, but url is not a mxc url`); return null; @@ -203,7 +203,8 @@ const Notifier = { // The permission request was dismissed or denied // TODO: Support alternative branding in messaging const description = result === 'denied' - ? _t('Riot does not have permission to send you notifications - please check your browser settings') + ? _t('Riot does not have permission to send you notifications - ' + + 'please check your browser settings') : _t('Riot was not given permission to send notifications - please try again'); const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog'); Modal.createTrackedDialog('Unable to enable Notifications', result, ErrorDialog, { diff --git a/src/Presence.js b/src/Presence.js index 8e00e95cdf..ca3db9b762 100644 --- a/src/Presence.js +++ b/src/Presence.js @@ -15,8 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -const MatrixClientPeg = require("./MatrixClientPeg"); -const dis = require("./dispatcher"); +import MatrixClientPeg from "./MatrixClientPeg"; +import dis from "./dispatcher"; import Timer from './utils/Timer'; // Time in ms after that a user is considered as unavailable/away @@ -24,7 +24,6 @@ const UNAVAILABLE_TIME_MS = 3 * 60 * 1000; // 3 mins const PRESENCE_STATES = ["online", "offline", "unavailable"]; class Presence { - constructor() { this._activitySignal = null; this._unavailableTimer = null; @@ -43,7 +42,7 @@ class Presence { try { await this._unavailableTimer.finished(); this.setState("unavailable"); - } catch(e) { /* aborted, stop got called */ } + } catch (e) { /* aborted, stop got called */ } } } @@ -88,7 +87,7 @@ class Presence { if (PRESENCE_STATES.indexOf(newState) === -1) { throw new Error("Bad presence state: " + newState); } - const old_state = this.state; + const oldState = this.state; this.state = newState; if (MatrixClientPeg.get().isGuest()) { @@ -98,9 +97,9 @@ class Presence { try { await MatrixClientPeg.get().setPresence(this.state); console.log("Presence: %s", newState); - } catch(err) { + } catch (err) { console.error("Failed to set presence: %s", err); - this.state = old_state; + this.state = oldState; } } } diff --git a/src/Roles.js b/src/Roles.js index 438b6c1236..10c4ceaf1e 100644 --- a/src/Roles.js +++ b/src/Roles.js @@ -26,7 +26,7 @@ export function levelRoleMap(usersDefault) { } export function textualPowerLevel(level, usersDefault) { - const LEVEL_ROLE_MAP = this.levelRoleMap(usersDefault); + const LEVEL_ROLE_MAP = levelRoleMap(usersDefault); if (LEVEL_ROLE_MAP[level]) { return LEVEL_ROLE_MAP[level] + (level !== undefined ? ` (${level})` : ` (${usersDefault})`); } else { diff --git a/src/VectorConferenceHandler.js b/src/VectorConferenceHandler.js index e839d3f78b..37b3a7ddad 100644 --- a/src/VectorConferenceHandler.js +++ b/src/VectorConferenceHandler.js @@ -14,12 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -"use strict"; - import Promise from 'bluebird'; -const Matrix = require("matrix-js-sdk"); -const Room = Matrix.Room; -const CallHandler = require('./CallHandler'); +import {createNewMatrixCall, Room} from "matrix-js-sdk"; +import CallHandler from './CallHandler'; +import MatrixClientPeg from "./MatrixClientPeg"; // FIXME: this is Riot (Vector) specific code, but will be removed shortly when // we switch over to jitsi entirely for video conferencing. @@ -45,7 +43,7 @@ ConferenceCall.prototype.setup = function() { // return a call for *this* room to be placed. We also tack on // confUserId to speed up lookups (else we'd need to loop every room // looking for a 1:1 room with this conf user ID!) - const call = Matrix.createNewMatrixCall(self.client, room.roomId); + const call = createNewMatrixCall(self.client, room.roomId); call.confUserId = self.confUserId; call.groupRoomId = self.groupRoomId; return call; @@ -84,7 +82,7 @@ ConferenceCall.prototype._getConferenceUserRoom = function() { preset: "private_chat", invite: [this.confUserId], }).then(function(res) { - return new Room(res.room_id, null, client.getUserId()); + return new Room(res.room_id, null, MatrixClientPeg.get().getUserId()); }); }; diff --git a/src/WhoIsTyping.js b/src/WhoIsTyping.js index 78ca77ce5a..eb09685cbe 100644 --- a/src/WhoIsTyping.js +++ b/src/WhoIsTyping.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -const MatrixClientPeg = require("./MatrixClientPeg"); +import MatrixClientPeg from "./MatrixClientPeg"; import { _t } from './languageHandler'; module.exports = { @@ -33,6 +33,9 @@ module.exports = { /** * Given a Room object and, optionally, a list of userID strings * to exclude, return a list of user objects who are typing. + * @param {Room} room: room object to get users from. + * @param {string[]} exclude: list of user mxids to exclude. + * @returns {string[]} list of user objects who are typing. */ usersTyping: function(room, exclude) { const whoIsTyping = []; @@ -46,7 +49,7 @@ module.exports = { const userId = memberKeys[i]; if (room.currentState.members[userId].typing) { - if (exclude.indexOf(userId) == -1) { + if (exclude.indexOf(userId) === -1) { whoIsTyping.push(room.currentState.members[userId]); } } @@ -60,16 +63,19 @@ module.exports = { if (whoIsTyping.length > limit) { othersCount = whoIsTyping.length - limit + 1; } - if (whoIsTyping.length == 0) { + if (whoIsTyping.length === 0) { return ''; - } else if (whoIsTyping.length == 1) { + } else if (whoIsTyping.length === 1) { return _t('%(displayName)s is typing …', {displayName: whoIsTyping[0].name}); } const names = whoIsTyping.map(function(m) { return m.name; }); if (othersCount>=1) { - return _t('%(names)s and %(count)s others are typing …', {names: names.slice(0, limit - 1).join(', '), count: othersCount}); + return _t('%(names)s and %(count)s others are typing …', { + names: names.slice(0, limit - 1).join(', '), + count: othersCount, + }); } else { const lastPerson = names.pop(); return _t('%(names)s and %(lastPerson)s are typing …', {names: names.join(', '), lastPerson: lastPerson}); diff --git a/src/linkify-matrix.js b/src/linkify-matrix.js index 50d50f219a..a9e894d582 100644 --- a/src/linkify-matrix.js +++ b/src/linkify-matrix.js @@ -44,7 +44,7 @@ function matrixLinkify(linkify) { const S_ROOMALIAS_COLON = new linkify.parser.State(); const S_ROOMALIAS_COLON_NUM = new linkify.parser.State(ROOMALIAS); - const roomname_tokens = [ + const roomnameTokens = [ TT.DOT, TT.PLUS, TT.NUM, @@ -58,8 +58,8 @@ function matrixLinkify(linkify) { TT.LOCALHOST, ]; - S_HASH.on(roomname_tokens, S_HASH_NAME); - S_HASH_NAME.on(roomname_tokens, S_HASH_NAME); + S_HASH.on(roomnameTokens, S_HASH_NAME); + S_HASH_NAME.on(roomnameTokens, S_HASH_NAME); S_HASH_NAME.on(TT.DOMAIN, S_HASH_NAME); S_HASH_NAME.on(TT.COLON, S_HASH_NAME_COLON); @@ -92,7 +92,7 @@ function matrixLinkify(linkify) { const S_USERID_COLON = new linkify.parser.State(); const S_USERID_COLON_NUM = new linkify.parser.State(USERID); - const username_tokens = [ + const usernameTokens = [ TT.DOT, TT.UNDERSCORE, TT.PLUS, @@ -100,12 +100,12 @@ function matrixLinkify(linkify) { TT.DOMAIN, TT.TLD, - // as in roomname_tokens + // as in roomnameTokens TT.LOCALHOST, ]; - S_AT.on(username_tokens, S_AT_NAME); - S_AT_NAME.on(username_tokens, S_AT_NAME); + S_AT.on(usernameTokens, S_AT_NAME); + S_AT_NAME.on(usernameTokens, S_AT_NAME); S_AT_NAME.on(TT.DOMAIN, S_AT_NAME); S_AT_NAME.on(TT.COLON, S_AT_NAME_COLON); @@ -138,7 +138,7 @@ function matrixLinkify(linkify) { const S_GROUPID_COLON = new linkify.parser.State(); const S_GROUPID_COLON_NUM = new linkify.parser.State(GROUPID); - const groupid_tokens = [ + const groupIdTokens = [ TT.DOT, TT.UNDERSCORE, TT.PLUS, @@ -146,12 +146,12 @@ function matrixLinkify(linkify) { TT.DOMAIN, TT.TLD, - // as in roomname_tokens + // as in roomnameTokens TT.LOCALHOST, ]; - S_PLUS.on(groupid_tokens, S_PLUS_NAME); - S_PLUS_NAME.on(groupid_tokens, S_PLUS_NAME); + S_PLUS.on(groupIdTokens, S_PLUS_NAME); + S_PLUS_NAME.on(groupIdTokens, S_PLUS_NAME); S_PLUS_NAME.on(TT.DOMAIN, S_PLUS_NAME); S_PLUS_NAME.on(TT.COLON, S_PLUS_NAME_COLON); @@ -179,14 +179,14 @@ const escapeRegExp = function(string) { // Recognise URLs from both our local vector and official vector as vector. // anyone else really should be using matrix.to. -matrixLinkify.VECTOR_URL_PATTERN = "^(?:https?:\/\/)?(?:" +matrixLinkify.VECTOR_URL_PATTERN = "^(?:https?://)?(?:" + escapeRegExp(window.location.host + window.location.pathname) + "|" + "(?:www\\.)?(?:riot|vector)\\.im/(?:app|beta|staging|develop)/" + ")(#.*)"; -matrixLinkify.MATRIXTO_URL_PATTERN = "^(?:https?:\/\/)?(?:www\\.)?matrix\\.to/#/(([#@!+]).*)"; +matrixLinkify.MATRIXTO_URL_PATTERN = "^(?:https?://)?(?:www\\.)?matrix\\.to/#/(([#@!+]).*)"; matrixLinkify.MATRIXTO_MD_LINK_PATTERN = - '\\[([^\\]]*)\\]\\((?:https?:\/\/)?(?:www\\.)?matrix\\.to/#/([#@!+][^\\)]*)\\)'; + '\\[([^\\]]*)\\]\\((?:https?://)?(?:www\\.)?matrix\\.to/#/([#@!+][^\\)]*)\\)'; matrixLinkify.MATRIXTO_BASE_URL= baseUrl; const matrixToEntityMap = { From c633df3c15b1e977bd55193a8c928128c5488927 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 18 Sep 2019 12:16:41 +0100 Subject: [PATCH 40/41] Use same initial device name rules for SSO login as password login Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/MatrixChat.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index d205326d0d..306ef03fb1 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -286,7 +286,10 @@ export default createReactClass({ // the first thing to do is to try the token params in the query-string // if the session isn't soft logged out (ie: is a clean session being logged in) if (!Lifecycle.isSoftLogout()) { - Lifecycle.attemptTokenLogin(this.props.realQueryParams).then((loggedIn) => { + Lifecycle.attemptTokenLogin( + this.props.realQueryParams, + this.props.defaultDeviceDisplayName, + ).then((loggedIn) => { if (loggedIn) { this.props.onTokenLoginCompleted(); From c286f2214f8858977938f67ec170377902a7e829 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 18 Sep 2019 14:09:38 +0100 Subject: [PATCH 41/41] Fix disabled save button on message editor when pasting Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/BasicMessageComposer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/rooms/BasicMessageComposer.js b/src/components/views/rooms/BasicMessageComposer.js index eabb97a6f5..110df355fe 100644 --- a/src/components/views/rooms/BasicMessageComposer.js +++ b/src/components/views/rooms/BasicMessageComposer.js @@ -179,6 +179,7 @@ export default class BasicMessageEditor extends React.Component { const {partCreator} = model; const text = event.clipboardData.getData("text/plain"); if (text) { + this._modifiedFlag = true; const range = getRangeForSelection(this._editorRef, model, document.getSelection()); const parts = parsePlainTextMessage(text, partCreator); replaceRangeAndMoveCaret(range, parts);