From bd7e9096995345c205c99ffb901d1e62493fb605 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 9 Oct 2019 16:54:05 +0100 Subject: [PATCH 01/12] js-sdk rc.1 --- package.json | 2 +- yarn.lock | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d2955f89be..86b8f74860 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.17.14", "lolex": "4.2", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", + "matrix-js-sdk": "2.4.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 ba7fea21ba..1a3dc593d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5187,9 +5187,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@github:matrix-org/matrix-js-sdk#develop": - version "2.4.1" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/e024d047e358cf26caa47542c8f6d9a469a11cb2" +matrix-js-sdk@2.4.2-rc.1: + version "2.4.2-rc.1" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.4.2-rc.1.tgz#0601c8020e34b6c0ecde6216f86f56664d7a9357" + integrity sha512-s8Bjvw6EkQQshHXC+aM846FJQdXTUIIyh5s+FRpW08yxA3I38/guF9cpJyCD44gZozXr+8c8VFTJ4Af2rRyV7A== dependencies: another-json "^0.2.0" babel-runtime "^6.26.0" From d86cf434f7293f8c5219fd3a141c0076fd97bf96 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 9 Oct 2019 16:57:14 +0100 Subject: [PATCH 02/12] Prepare changelog for v1.7.0-rc.1 --- CHANGELOG.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89faf70d42..adf985c7ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,52 @@ +Changes in [1.7.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.7.0-rc.1) (2019-10-09) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.6.2...v1.7.0-rc.1) + + * Update from Weblate + [\#3539](https://github.com/matrix-org/matrix-react-sdk/pull/3539) + * React error/warning cleanup + [\#3529](https://github.com/matrix-org/matrix-react-sdk/pull/3529) + * Add label to rageshakes for React soft crashes + [\#3535](https://github.com/matrix-org/matrix-react-sdk/pull/3535) + * Support UI Auth on adding email addresses & phone numbers + [\#3534](https://github.com/matrix-org/matrix-react-sdk/pull/3534) + * Unmount React components before stopping the client + [\#3533](https://github.com/matrix-org/matrix-react-sdk/pull/3533) + * Fix soft crash on room join + [\#3532](https://github.com/matrix-org/matrix-react-sdk/pull/3532) + * Fix: Unable to verify email address error + [\#3528](https://github.com/matrix-org/matrix-react-sdk/pull/3528) + * Fix: submit create room dialog when pressing enter + [\#3509](https://github.com/matrix-org/matrix-react-sdk/pull/3509) + * Allow cyclic objects in console logs + [\#3531](https://github.com/matrix-org/matrix-react-sdk/pull/3531) + * Fix: watch emoticon autoreplace setting + [\#3530](https://github.com/matrix-org/matrix-react-sdk/pull/3530) + * Make "remove recent messages" more robust + [\#3508](https://github.com/matrix-org/matrix-react-sdk/pull/3508) + * Label submit button in UI auth password prompt + [\#3527](https://github.com/matrix-org/matrix-react-sdk/pull/3527) + * Null-guard the recaptcha setup + [\#3526](https://github.com/matrix-org/matrix-react-sdk/pull/3526) + * Use a mask instead of an img for "Show image" eye + [\#3513](https://github.com/matrix-org/matrix-react-sdk/pull/3513) + * Only limit the rageshake log size in one place + [\#3523](https://github.com/matrix-org/matrix-react-sdk/pull/3523) + * Rename UPPER_CAMEL_CASE to UPPER_SNAKE_CASE in Coding Style + [\#3525](https://github.com/matrix-org/matrix-react-sdk/pull/3525) + * Revert "Run yarn upgrade" + [\#3524](https://github.com/matrix-org/matrix-react-sdk/pull/3524) + * Run yarn upgrade + [\#3521](https://github.com/matrix-org/matrix-react-sdk/pull/3521) + * Limit Backspace-consuming workaround to just Slate, tidy Keyboard :) + [\#3522](https://github.com/matrix-org/matrix-react-sdk/pull/3522) + * Enable CIDER composer by default + [\#3519](https://github.com/matrix-org/matrix-react-sdk/pull/3519) + * Update from Weblate + [\#3520](https://github.com/matrix-org/matrix-react-sdk/pull/3520) + * Cull some easily fixable errors which make the console a mess + [\#3516](https://github.com/matrix-org/matrix-react-sdk/pull/3516) + Changes in [1.6.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.6.2) (2019-10-04) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.6.2-rc.1...v1.6.2) From 558a8b72f8ab63d4be698b7b8fee3968b0ba8657 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Wed, 9 Oct 2019 16:57:14 +0100 Subject: [PATCH 03/12] v1.7.0-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 86b8f74860..f1a137f628 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.6.2", + "version": "1.7.0-rc.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 537bd3700d6565809964d53804b5785ce3f81e79 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 9 Oct 2019 22:27:49 +0100 Subject: [PATCH 04/12] SettingsFlag always run ToggleSwitch fully-controlled Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/SettingsFlag.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/components/views/elements/SettingsFlag.js b/src/components/views/elements/SettingsFlag.js index e4df15a096..f557690514 100644 --- a/src/components/views/elements/SettingsFlag.js +++ b/src/components/views/elements/SettingsFlag.js @@ -62,13 +62,6 @@ module.exports = createReactClass({ }, render: function() { - const value = this.props.manualSave ? this.state.value : SettingsStore.getValueAt( - this.props.level, - this.props.name, - this.props.roomId, - this.props.isExplicit, - ); - const canChange = SettingsStore.canSetValue(this.props.name, this.props.roomId, this.props.level); let label = this.props.label; @@ -78,7 +71,7 @@ module.exports = createReactClass({ return (
{label} - +
); }, From c1b591dfa2c13db46160f97ed6d20788c4d19c1f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 9 Oct 2019 22:33:14 +0100 Subject: [PATCH 05/12] actually always run fully controlled Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/SettingsFlag.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/SettingsFlag.js b/src/components/views/elements/SettingsFlag.js index f557690514..b4f372073c 100644 --- a/src/components/views/elements/SettingsFlag.js +++ b/src/components/views/elements/SettingsFlag.js @@ -48,7 +48,7 @@ module.exports = createReactClass({ if (this.props.group && !checked) return; if (!this.props.manualSave) this.save(checked); - else this.setState({ value: checked }); + this.setState({ value: checked }); if (this.props.onChange) this.props.onChange(checked); }, From 55f4a0cb441241f0cf867bf0fc3ceb5214ec036e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 9 Oct 2019 23:20:59 +0100 Subject: [PATCH 06/12] remove SettingsFlag manualSave altogether Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/SettingsFlag.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/views/elements/SettingsFlag.js b/src/components/views/elements/SettingsFlag.js index b4f372073c..a3a6d18d33 100644 --- a/src/components/views/elements/SettingsFlag.js +++ b/src/components/views/elements/SettingsFlag.js @@ -30,7 +30,6 @@ module.exports = createReactClass({ label: PropTypes.string, // untranslated onChange: PropTypes.func, isExplicit: PropTypes.bool, - manualSave: PropTypes.bool, }, getInitialState: function() { @@ -47,7 +46,7 @@ module.exports = createReactClass({ onChange: function(checked) { if (this.props.group && !checked) return; - if (!this.props.manualSave) this.save(checked); + this.save(checked); this.setState({ value: checked }); if (this.props.onChange) this.props.onChange(checked); }, From 9dd93c52b077c59f719486fdaa7309884bb0c1b5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 10 Oct 2019 16:39:41 +0200 Subject: [PATCH 07/12] safeguard if the offsetnode is null when determining caret position --- src/editor/dom.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/editor/dom.js b/src/editor/dom.js index 9073eb37a3..e82c3f70ca 100644 --- a/src/editor/dom.js +++ b/src/editor/dom.js @@ -92,6 +92,10 @@ function getSelectionOffsetAndText(editor, selectionNode, selectionOffset) { // gets the caret position details, ignoring and adjusting to // the ZWS if you're typing in a caret node function getCaret(node, offsetToNode, offsetWithinNode) { + // if no node is selected, return an offset at the start + if (!node) { + return new DocumentOffset(0, false); + } let atNodeEnd = offsetWithinNode === node.textContent.length; if (node.nodeType === Node.TEXT_NODE && isCaretNode(node.parentElement)) { const zwsIdx = node.nodeValue.indexOf(CARET_NODE_CHAR); From 004c3900a901a38756ea6a916ec53d1471d23c4f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 10 Oct 2019 16:40:03 +0200 Subject: [PATCH 08/12] don't persist caret when selection is missing so caret will be put back at end of editor when remounting --- src/components/views/rooms/EditMessageComposer.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/EditMessageComposer.js b/src/components/views/rooms/EditMessageComposer.js index 3430e793ac..aec35a74ad 100644 --- a/src/components/views/rooms/EditMessageComposer.js +++ b/src/components/views/rooms/EditMessageComposer.js @@ -209,9 +209,18 @@ export default class EditMessageComposer extends React.Component { } componentWillUnmount() { + // store caret and serialized parts in the + // editorstate so it can be restored when the remote echo event tile gets rendered + // in case we're currently editing a pending event const sel = document.getSelection(); - const {caret} = getCaretOffsetAndText(this._editorRef, sel); + let caret; + if (sel.focusNode) { + caret = getCaretOffsetAndText(this._editorRef, sel).caret; + } const parts = this.model.serializeParts(); + // if caret is undefined because for some reason there isn't a valid selection, + // then when mounting the editor again with the same editor state, + // it will set the cursor at the end. this.props.editState.setEditorState(caret, parts); } @@ -238,7 +247,7 @@ export default class EditMessageComposer extends React.Component { _getInitialCaretPosition() { const {editState} = this.props; let caretPosition; - if (editState.hasEditorState()) { + if (editState.hasEditorState() && editState.getCaret()) { // if restoring state from a previous editor, // restore caret position from the state const caret = editState.getCaret(); From c663a57dff27f6c41ae45fa24ea4e491edffcb8b Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 10 Oct 2019 17:36:22 +0100 Subject: [PATCH 09/12] Add some type checking on event body --- src/HtmlUtils.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index 7a212b2497..2266522bfe 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -412,11 +412,13 @@ export function bodyToHtml(content, highlights, opts={}) { }; } - let formattedBody = content.formatted_body; - if (opts.stripReplyFallback && formattedBody) formattedBody = ReplyThread.stripHTMLReply(formattedBody); - strippedBody = opts.stripReplyFallback ? ReplyThread.stripPlainReply(content.body) : content.body; + let formattedBody = typeof content.formatted_body === 'string' ? content.formatted_body : null; + const plainBody = typeof content.body === 'string' ? content.body : null; - bodyHasEmoji = mightContainEmoji(isHtmlMessage ? formattedBody : content.body); + if (opts.stripReplyFallback && formattedBody) formattedBody = ReplyThread.stripHTMLReply(formattedBody); + strippedBody = opts.stripReplyFallback ? ReplyThread.stripPlainReply(plainBody) : plainBody; + + bodyHasEmoji = mightContainEmoji(isHtmlMessage ? formattedBody : plainBody); // Only generate safeBody if the message was sent as org.matrix.custom.html if (isHtmlMessage) { From 21bb1dc837eb747fa782a9005b4b80fcad882637 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 18 Oct 2019 14:43:08 +0100 Subject: [PATCH 10/12] Upgrade to JS SDK v2.4.2 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f1a137f628..7ef68ff8f1 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.17.14", "lolex": "4.2", - "matrix-js-sdk": "2.4.2-rc.1", + "matrix-js-sdk": "2.4.2", "optimist": "^0.6.1", "pako": "^1.0.5", "png-chunks-extract": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index 1a3dc593d0..ac23c2983a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5187,10 +5187,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.4.2-rc.1: - version "2.4.2-rc.1" - resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.4.2-rc.1.tgz#0601c8020e34b6c0ecde6216f86f56664d7a9357" - integrity sha512-s8Bjvw6EkQQshHXC+aM846FJQdXTUIIyh5s+FRpW08yxA3I38/guF9cpJyCD44gZozXr+8c8VFTJ4Af2rRyV7A== +matrix-js-sdk@2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/matrix-js-sdk/-/matrix-js-sdk-2.4.2.tgz#e9c3c929469e0d885463d22f927f7ac38ad5f209" + integrity sha512-DkkUk6IX56Pkz9S7RYLn2XeTRVMrLiFOAavZvzWHs/m+k8JFtjDmJ8JVJLDA12+kL9h6rXYDN80/99RfFZH3hA== dependencies: another-json "^0.2.0" babel-runtime "^6.26.0" From 2557d893857d3b3dd59d7d1799762b3af93b7845 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 18 Oct 2019 14:48:33 +0100 Subject: [PATCH 11/12] Prepare changelog for v1.7.0 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index adf985c7ce..b95cc03595 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +Changes in [1.7.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.7.0) (2019-10-18) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.7.0-rc.1...v1.7.0) + + * Upgrade to JS SDK v2.4.2 + * Fix: edit unmount when no selection + [\#3545](https://github.com/matrix-org/matrix-react-sdk/pull/3545) + * "SettingsFlag always run ToggleSwitch fully controlled" to release + [\#3542](https://github.com/matrix-org/matrix-react-sdk/pull/3542) + Changes in [1.7.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.7.0-rc.1) (2019-10-09) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.6.2...v1.7.0-rc.1) From 86a564b2f0b10e55665a2f9c78145b0fcff6130d Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Fri, 18 Oct 2019 14:48:34 +0100 Subject: [PATCH 12/12] v1.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ef68ff8f1..7c3e4a493e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.7.0-rc.1", + "version": "1.7.0", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {