From 2fbda42374d8f044cf6116364122bd94f45645ad Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 07:53:06 +0000 Subject: [PATCH 1/8] Fix buttons in right panel verif --- res/css/views/right_panel/_UserInfo.scss | 1 + src/components/views/verification/VerificationShowSas.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/res/css/views/right_panel/_UserInfo.scss b/res/css/views/right_panel/_UserInfo.scss index 9ce524c5ac..c275f42222 100644 --- a/res/css/views/right_panel/_UserInfo.scss +++ b/res/css/views/right_panel/_UserInfo.scss @@ -263,6 +263,7 @@ limitations under the License. .mx_UserInfo_verify { display: block; margin: 16px 0; + width: 100%; } } diff --git a/src/components/views/verification/VerificationShowSas.js b/src/components/views/verification/VerificationShowSas.js index 7b93f42983..ec222159ab 100644 --- a/src/components/views/verification/VerificationShowSas.js +++ b/src/components/views/verification/VerificationShowSas.js @@ -95,7 +95,7 @@ export default class VerificationShowSas extends React.Component { confirm = Date: Wed, 29 Jan 2020 07:53:23 +0000 Subject: [PATCH 2/8] Fix MemberInfo handling User objects without crashing --- src/components/views/rooms/MemberInfo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index 55855bbc9a..7c77c546b6 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -1113,7 +1113,8 @@ export default createReactClass({ } } - const avatarUrl = this.props.member.getMxcAvatarUrl(); + const {member} = this.props; + const avatarUrl = member.avatarUrl || (member.getMxcAvatarUrl && member.getMxcAvatarUrl()); let avatarElement; if (avatarUrl) { const httpUrl = this.context.mxcUrlToHttp(avatarUrl, 800, 800); From 3d47e259553d15c6e6d1b08b10a2070c42f7c4a6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 07:53:45 +0000 Subject: [PATCH 3/8] improve PropTypes for better rageshakes --- .../views/right_panel/VerificationPanel.js | 19 ++++++++++++++++++- .../views/verification/VerificationShowSas.js | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index 3740c6e49d..46179183e1 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React from 'react'; +import React from "react"; +import PropTypes from "prop-types"; import * as sdk from '../../../index'; import {verificationMethods} from 'matrix-js-sdk/src/crypto'; @@ -23,6 +24,8 @@ import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {_t} from "../../../languageHandler"; import E2EIcon from "../rooms/E2EIcon"; import { + PHASE_UNSENT, + PHASE_REQUESTED, PHASE_READY, PHASE_DONE, PHASE_STARTED, @@ -31,6 +34,20 @@ import { import Spinner from "../elements/Spinner"; export default class VerificationPanel extends React.PureComponent { + static propTypes = { + request: PropTypes.object.isRequired, + member: PropTypes.object.isRequired, + phase: PropTypes.oneOf([ + PHASE_UNSENT, + PHASE_REQUESTED, + PHASE_READY, + PHASE_STARTED, + PHASE_CANCELLED, + PHASE_DONE, + ]).isRequired, + onClose: PropTypes.func.isRequired, + }; + constructor(props) { super(props); this.state = {}; diff --git a/src/components/views/verification/VerificationShowSas.js b/src/components/views/verification/VerificationShowSas.js index ec222159ab..aee0f57cf8 100644 --- a/src/components/views/verification/VerificationShowSas.js +++ b/src/components/views/verification/VerificationShowSas.js @@ -27,7 +27,8 @@ function capFirst(s) { export default class VerificationShowSas extends React.Component { static propTypes = { - displayName: PropTypes.string.isRequired, + pending: PropTypes.bool, + displayName: PropTypes.string, // required if pending is true onDone: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired, sas: PropTypes.object.isRequired, From d824145638adba42a753bb1518b4335c0758b487 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 07:54:10 +0000 Subject: [PATCH 4/8] show as pending whilst in an empty state until told better to prevent a flash --- src/components/views/right_panel/EncryptionPanel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/EncryptionPanel.js b/src/components/views/right_panel/EncryptionPanel.js index d45280e29c..4e147bd7a5 100644 --- a/src/components/views/right_panel/EncryptionPanel.js +++ b/src/components/views/right_panel/EncryptionPanel.js @@ -36,7 +36,7 @@ const EncryptionPanel = ({verificationRequest, member, onClose}) => { setRequest(verificationRequest); }, [verificationRequest]); - const [phase, setPhase] = useState(false); + const [phase, setPhase] = useState(undefined); const changeHandler = useCallback(() => { // handle transitions -> cancelled for mismatches which fire a modal instead of showing a card if (request && request.cancelled && MISMATCHES.includes(request.cancellationCode)) { @@ -71,7 +71,7 @@ const EncryptionPanel = ({verificationRequest, member, onClose}) => { setRequest(verificationRequest); }, [member.userId]); - const requested = request && phase === PHASE_REQUESTED; + const requested = request && (phase === PHASE_REQUESTED || phase === undefined); if (!request || requested) { return ; } else { From 2aa21d9199396dca19f4b9e0867be298e48b9d35 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 07:54:28 +0000 Subject: [PATCH 5/8] reload on enabling cross-signing just to make things generally happier --- src/settings/Settings.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 37a211e905..6011f0499a 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -147,6 +147,7 @@ export const SETTINGS = { displayName: _td("Enable cross-signing to verify per-user instead of per-device (in development)"), supportedLevels: LEVELS_FEATURE, default: false, + controller: new ReloadOnChangeController(), }, "feature_event_indexing": { isFeature: true, From 61d0021c8eef4f7d558a596800e7d210510c7cea Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 07:58:43 +0000 Subject: [PATCH 6/8] Fix styling special case for DialogButtons --- res/css/views/right_panel/_UserInfo.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/res/css/views/right_panel/_UserInfo.scss b/res/css/views/right_panel/_UserInfo.scss index c275f42222..dc22de4713 100644 --- a/res/css/views/right_panel/_UserInfo.scss +++ b/res/css/views/right_panel/_UserInfo.scss @@ -263,7 +263,9 @@ limitations under the License. .mx_UserInfo_verify { display: block; margin: 16px 0; - width: 100%; + } + button.mx_UserInfo_verify { + width: 100%; // FIXME get rid of this once we get rid of DialogButtons here } } From 0bb423fd5ad9aecf3b6d408471fefb2699d008b3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 08:00:32 +0000 Subject: [PATCH 7/8] Add console log on unhandled error to track down rageshake --- src/components/views/right_panel/VerificationPanel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index 46179183e1..2d3fdd3f40 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -164,11 +164,11 @@ export default class VerificationPanel extends React.PureComponent { } render() { - const {member} = this.props; + const {member, phase} = this.props; const displayName = member.displayName || member.name || member.userId; - switch (this.props.phase) { + switch (phase) { case PHASE_READY: return this.renderQRPhase(); case PHASE_STARTED: @@ -191,6 +191,7 @@ export default class VerificationPanel extends React.PureComponent { case PHASE_CANCELLED: return this.renderCancelledPhase(); } + console.error("VerificationPanel unhandled phase:", phase) return null; } From 37e568448d8a09dae730d1334c04794cca089899 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 29 Jan 2020 08:08:52 +0000 Subject: [PATCH 8/8] delint --- src/components/views/right_panel/VerificationPanel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index 2d3fdd3f40..18a9024310 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -191,7 +191,7 @@ export default class VerificationPanel extends React.PureComponent { case PHASE_CANCELLED: return this.renderCancelledPhase(); } - console.error("VerificationPanel unhandled phase:", phase) + console.error("VerificationPanel unhandled phase:", phase); return null; }