From 69d9080dd5207fffe59e306540b24ece6e90f0dd Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 27 Mar 2018 11:17:49 +0100 Subject: [PATCH 1/9] Track duration of page changes The duration measured is between - componentWillUpdate of MatrixChat and - componentDidUpdate of MatrixChat. This does not account for *all* changes to the view that occur when a room switch happens, for example. But it does at least capture the difference between switching to a "big" room and switching to a small test room. --- src/Analytics.js | 21 +++++++++++++++++++++ src/components/structures/MatrixChat.js | 19 +++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/Analytics.js b/src/Analytics.js index 5f4a0d0c77..ab47d30c1d 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -74,6 +74,7 @@ class Analytics { this._paq = null; this.disabled = true; this.firstPage = true; + this.generationTimeMs = null; } /** @@ -147,6 +148,23 @@ class Analytics { return true; } + startPageChangeTimer() { + performance.clearMarks('riot_page_change_start'); + performance.mark('riot_page_change_start'); + } + + stopPageChangeTimer() { + performance.mark('riot_page_change_stop'); + performance.measure( + 'riot_page_change_delta', + 'riot_page_change_start', + 'riot_page_change_stop', + ); + + const measurement = performance.getEntriesByName('riot_page_change_delta').pop(); + this.generationTimeMs = measurement.duration; + } + trackPageChange() { if (this.disabled) return; if (this.firstPage) { @@ -156,6 +174,9 @@ class Analytics { return; } this._paq.push(['setCustomUrl', getRedactedUrl()]); + if (typeof this.generationTimeMs === 'number') { + this._paq.push(['setGenerationTimeMs', this.generationTimeMs]); + } this._paq.push(['trackPageView']); } diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 1312abda09..a898808141 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -368,13 +368,29 @@ export default React.createClass({ window.removeEventListener('resize', this.handleResize); }, - componentDidUpdate: function() { + componentWillUpdate: function(props, state) { + if (this.shouldTrackPageChange(this.state, state)) { + Analytics.startPageChangeTimer(); + } + }, + + componentDidUpdate: function(prevProps, prevState) { + if (this.shouldTrackPageChange(prevState, this.state)) { + Analytics.stopPageChangeTimer(); + Analytics.trackPageChange(); + } if (this.focusComposer) { dis.dispatch({action: 'focus_composer'}); this.focusComposer = false; } }, + shouldTrackPageChange(prevState, state) { + return prevState.currentRoomId !== state.currentRoomId || + prevState.view !== state.view || + prevState.page_type !== state.page_type; + }, + setStateForNewView: function(state) { if (state.view === undefined) { throw new Error("setStateForNewView with no view!"); @@ -1341,7 +1357,6 @@ export default React.createClass({ if (this.props.onNewScreen) { this.props.onNewScreen(screen); } - Analytics.trackPageChange(); }, onAliasClick: function(event, alias) { From c8312dd5ae0e94629bb6e69f420f3654ff42e94a Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 28 Mar 2018 10:25:28 +0100 Subject: [PATCH 2/9] Use a less fragile API to track page change performance --- src/Analytics.js | 23 +++------------- src/components/structures/MatrixChat.js | 35 ++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/Analytics.js b/src/Analytics.js index ab47d30c1d..bb9f900145 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -148,24 +148,7 @@ class Analytics { return true; } - startPageChangeTimer() { - performance.clearMarks('riot_page_change_start'); - performance.mark('riot_page_change_start'); - } - - stopPageChangeTimer() { - performance.mark('riot_page_change_stop'); - performance.measure( - 'riot_page_change_delta', - 'riot_page_change_start', - 'riot_page_change_stop', - ); - - const measurement = performance.getEntriesByName('riot_page_change_delta').pop(); - this.generationTimeMs = measurement.duration; - } - - trackPageChange() { + trackPageChange(generationTimeMs) { if (this.disabled) return; if (this.firstPage) { // De-duplicate first page @@ -174,8 +157,8 @@ class Analytics { return; } this._paq.push(['setCustomUrl', getRedactedUrl()]); - if (typeof this.generationTimeMs === 'number') { - this._paq.push(['setGenerationTimeMs', this.generationTimeMs]); + if (typeof generationTimeMs === 'number') { + this._paq.push(['setGenerationTimeMs', generationTimeMs]); } this._paq.push(['trackPageView']); } diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index a898808141..2c38e3d26e 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -370,14 +370,14 @@ export default React.createClass({ componentWillUpdate: function(props, state) { if (this.shouldTrackPageChange(this.state, state)) { - Analytics.startPageChangeTimer(); + this.startPageChangeTimer(); } }, componentDidUpdate: function(prevProps, prevState) { if (this.shouldTrackPageChange(prevState, this.state)) { - Analytics.stopPageChangeTimer(); - Analytics.trackPageChange(); + const durationMs = this.stopPageChangeTimer(); + Analytics.trackPageChange(durationMs); } if (this.focusComposer) { dis.dispatch({action: 'focus_composer'}); @@ -385,6 +385,35 @@ export default React.createClass({ } }, + startPageChangeTimer() { + // This shouldn't happen because componentWillUpdate and componentDidUpdate + // are used. + if (this._pageChanging) { + console.warn('MatrixChat.startPageChangeTimer: timer already started'); + return; + } + this._pageChanging = true; + performance.mark('riot_MatrixChat_page_change_start'); + }, + + stopPageChangeTimer() { + if (!this._pageChanging) { + console.warn('MatrixChat.stopPageChangeTimer: timer not started'); + return; + } + this._pageChanging = false; + performance.mark('riot_MatrixChat_page_change_stop'); + performance.measure( + 'riot_MatrixChat_page_change_delta', + 'riot_MatrixChat_page_change_start', + 'riot_MatrixChat_page_change_stop', + ); + performance.clearMarks('riot_MatrixChat_page_change_start'); + performance.clearMarks('riot_MatrixChat_page_change_stop'); + const measurement = performance.getEntriesByName('riot_MatrixChat_page_change_delta').pop(); + return measurement.duration; + }, + shouldTrackPageChange(prevState, state) { return prevState.currentRoomId !== state.currentRoomId || prevState.view !== state.view || From 187e8ab8a8d07b6efc63801fc356133c154c6fa8 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 28 Mar 2018 10:27:24 +0100 Subject: [PATCH 3/9] Remove unused variable --- src/Analytics.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Analytics.js b/src/Analytics.js index bb9f900145..bb49c19cf5 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -74,7 +74,6 @@ class Analytics { this._paq = null; this.disabled = true; this.firstPage = true; - this.generationTimeMs = null; } /** From f29b58aba542350f2729bcd61932b6a5ebb41bc4 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 28 Mar 2018 10:31:03 +0100 Subject: [PATCH 4/9] Always expect generationTimeMs --- src/Analytics.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Analytics.js b/src/Analytics.js index bb49c19cf5..2ef058b11b 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -148,6 +148,9 @@ class Analytics { } trackPageChange(generationTimeMs) { + if (typeof generationTimeMs !== 'number') { + throw new Error('Analytics.trackPageChange: expected generationTimeMs to be a number'); + } if (this.disabled) return; if (this.firstPage) { // De-duplicate first page @@ -156,9 +159,7 @@ class Analytics { return; } this._paq.push(['setCustomUrl', getRedactedUrl()]); - if (typeof generationTimeMs === 'number') { - this._paq.push(['setGenerationTimeMs', generationTimeMs]); - } + this._paq.push(['setGenerationTimeMs', generationTimeMs]); this._paq.push(['trackPageView']); } From 00167fbc0622e2b2a08247622bd00229b6e67ed4 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 28 Mar 2018 11:25:28 +0100 Subject: [PATCH 5/9] Init page change state in willMount --- src/components/structures/MatrixChat.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 2c38e3d26e..92baecb787 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -291,6 +291,8 @@ export default React.createClass({ this.handleResize(); window.addEventListener('resize', this.handleResize); + this._pageChanging = false; + // check we have the right tint applied for this theme. // N.B. we don't call the whole of setTheme() here as we may be // racing with the theme CSS download finishing from index.js From 385211528d5c739a753ef3326db3832045b880f9 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 29 Mar 2018 12:36:59 +0100 Subject: [PATCH 6/9] Implement "Join this community" button for groups that have truthy summary.profile.is_joinable. --- src/components/structures/GroupView.js | 108 ++++++++++++++++++------- 1 file changed, 80 insertions(+), 28 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 2b5b3d5353..c8773296e5 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -670,6 +670,20 @@ export default React.createClass({ }); }, + _onJoinClick: function() { + this.setState({membershipBusy: true}); + this._matrixClient.joinGroup(this.props.groupId).then(() => { + // don't reset membershipBusy here: wait for the membership change to come down the sync + }).catch((e) => { + this.setState({membershipBusy: false}); + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createTrackedDialog('Error joining room', '', ErrorDialog, { + title: _t("Error"), + description: _t("Unable to join community"), + }); + }); + }, + _onLeaveClick: function() { const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); Modal.createTrackedDialog('Leave Group', '', QuestionDialog, { @@ -686,9 +700,9 @@ export default React.createClass({ }).catch((e) => { this.setState({membershipBusy: false}); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); - Modal.createTrackedDialog('Error leaving room', '', ErrorDialog, { + Modal.createTrackedDialog('Error leaving community', '', ErrorDialog, { title: _t("Error"), - description: _t("Unable to leave room"), + description: _t("Unable to leave community"), }); }); }, @@ -853,9 +867,8 @@ export default React.createClass({ const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); const group = this._matrixClient.getGroup(this.props.groupId); - if (!group) return null; - if (group.myMembership === 'invite') { + if (group && group.myMembership === 'invite') { if (this.state.membershipBusy || this.state.inviterProfileBusy) { return
@@ -896,33 +909,72 @@ export default React.createClass({
; - } else if (group.myMembership === 'join' && this.state.editing) { - const leaveButtonTooltip = this.state.isUserPrivileged ? + } + + let membershipContainerExtraClasses; + let membershipButtonExtraClasses; + let membershipButtonTooltip; + let membershipButtonText; + let membershipButtonOnClick; + + // User is not in the group + if ((!group || group.myMembership === 'leave') && + this.state.summary && + this.state.summary.profile && + Boolean(this.state.summary.profile.is_joinable) + ) { + membershipButtonText = _t("Join this community"); + membershipButtonOnClick = this._onJoinClick; + + membershipButtonExtraClasses = 'mx_GroupView_joinButton'; + membershipContainerExtraClasses = 'mx_GroupView_membershipSection_leave'; + } else if ( + group && + group.myMembership === 'join' && + this.state.editing + ) { + membershipButtonText = _t("Leave this community"); + membershipButtonOnClick = this._onLeaveClick; + membershipButtonTooltip = this.state.isUserPrivileged ? _t("You are an administrator of this community") : _t("You are a member of this community"); - const leaveButtonClasses = classnames({ - "mx_RoomHeader_textButton": true, - "mx_GroupView_textButton": true, - "mx_GroupView_leaveButton": true, - "mx_RoomHeader_textButton_danger": this.state.isUserPrivileged, - }); - return
-
- { /* Empty div for flex alignment */ } -
-
- - { _t("Leave") } - -
-
-
; + + membershipButtonExtraClasses = { + 'mx_GroupView_leaveButton': true, + 'mx_RoomHeader_textButton_danger': this.state.isUserPrivileged, + }; + membershipContainerExtraClasses = 'mx_GroupView_membershipSection_joined'; + } else { + return null; } - return null; + + const membershipButtonClasses = classnames([ + 'mx_RoomHeader_textButton', + 'mx_GroupView_textButton', + ], + membershipButtonExtraClasses, + ); + + const membershipContainerClasses = classnames( + 'mx_GroupView_membershipSection', + membershipContainerExtraClasses, + ); + + return
+
+ { /* Empty div for flex alignment */ } +
+
+ + { membershipButtonText } + +
+
+
; }, _getLongDescriptionNode: function() { From 2dea5cd2336d4bcf07c46e56f37923f7b63c6217 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 29 Mar 2018 12:39:21 +0100 Subject: [PATCH 7/9] run gen-i18n --- src/i18n/strings/en_EN.json | 66 +++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 2d3ef836e0..db57eedc72 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -38,10 +38,6 @@ "The file '%(fileName)s' failed to upload": "The file '%(fileName)s' failed to upload", "The file '%(fileName)s' exceeds this home server's size limit for uploads": "The file '%(fileName)s' exceeds this home server's size limit for uploads", "Upload Failed": "Upload Failed", - "Failure to create room": "Failure to create room", - "Server may be unavailable, overloaded, or you hit a bug.": "Server may be unavailable, overloaded, or you hit a bug.", - "Send anyway": "Send anyway", - "Send": "Send", "Sun": "Sun", "Mon": "Mon", "Tue": "Tue", @@ -81,7 +77,6 @@ "Failed to invite users to community": "Failed to invite users to community", "Failed to invite users to %(groupId)s": "Failed to invite users to %(groupId)s", "Failed to add the following rooms to %(groupId)s:": "Failed to add the following rooms to %(groupId)s:", - "Unnamed Room": "Unnamed Room", "Riot does not have permission to send you notifications - please check your browser settings": "Riot does not have permission to send you notifications - please check your browser settings", "Riot was not given permission to send notifications - please try again": "Riot was not given permission to send notifications - please try again", "Unable to enable Notifications": "Unable to enable Notifications", @@ -179,6 +174,11 @@ "%(names)s and %(count)s others are typing|other": "%(names)s and %(count)s others are typing", "%(names)s and %(count)s others are typing|one": "%(names)s and one other is typing", "%(names)s and %(lastPerson)s are typing": "%(names)s and %(lastPerson)s are typing", + "Failure to create room": "Failure to create room", + "Server may be unavailable, overloaded, or you hit a bug.": "Server may be unavailable, overloaded, or you hit a bug.", + "Send anyway": "Send anyway", + "Send": "Send", + "Unnamed Room": "Unnamed Room", "Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions", "Not a valid Riot keyfile": "Not a valid Riot keyfile", "Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?", @@ -186,7 +186,6 @@ "Message Replies": "Message Replies", "Message Pinning": "Message Pinning", "Presence Management": "Presence Management", - "Tag Panel": "Tag Panel", "Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing", "Use compact timeline layout": "Use compact timeline layout", "Hide removed messages": "Hide removed messages", @@ -253,29 +252,6 @@ "Failed to set display name": "Failed to set display name", "Disable Notifications": "Disable Notifications", "Enable Notifications": "Enable Notifications", - "Invalid alias format": "Invalid alias format", - "'%(alias)s' is not a valid format for an alias": "'%(alias)s' is not a valid format for an alias", - "Invalid address format": "Invalid address format", - "'%(alias)s' is not a valid format for an address": "'%(alias)s' is not a valid format for an address", - "not specified": "not specified", - "not set": "not set", - "Remote addresses for this room:": "Remote addresses for this room:", - "Addresses": "Addresses", - "The main address for this room is": "The main address for this room is", - "Local addresses for this room:": "Local addresses for this room:", - "This room has no local addresses": "This room has no local addresses", - "New address (e.g. #foo:%(localDomain)s)": "New address (e.g. #foo:%(localDomain)s)", - "Invalid community ID": "Invalid community ID", - "'%(groupId)s' is not a valid community ID": "'%(groupId)s' is not a valid community ID", - "Flair": "Flair", - "Showing flair for these communities:": "Showing flair for these communities:", - "This room is not showing flair for any communities": "This room is not showing flair for any communities", - "New community ID (e.g. +foo:%(localDomain)s)": "New community ID (e.g. +foo:%(localDomain)s)", - "You have enabled URL previews by default.": "You have enabled URL previews by default.", - "You have disabled URL previews by default.": "You have disabled URL previews by default.", - "URL previews are enabled by default for participants in this room.": "URL previews are enabled by default for participants in this room.", - "URL previews are disabled by default for participants in this room.": "URL previews are disabled by default for participants in this room.", - "URL Previews": "URL Previews", "Cannot add any more widgets": "Cannot add any more widgets", "The maximum permitted number of widgets have already been added to this room.": "The maximum permitted number of widgets have already been added to this room.", "Add a widget": "Add a widget", @@ -371,11 +347,11 @@ "numbullet": "numbullet", "Markdown is disabled": "Markdown is disabled", "Markdown is enabled": "Markdown is enabled", + "Unpin Message": "Unpin Message", + "Jump to message": "Jump to message", "No pinned messages.": "No pinned messages.", "Loading...": "Loading...", "Pinned Messages": "Pinned Messages", - "Unpin Message": "Unpin Message", - "Jump to message": "Jump to message", "%(duration)ss": "%(duration)ss", "%(duration)sm": "%(duration)sm", "%(duration)sh": "%(duration)sh", @@ -498,6 +474,29 @@ "Scroll to unread messages": "Scroll to unread messages", "Jump to first unread message.": "Jump to first unread message.", "Close": "Close", + "Invalid alias format": "Invalid alias format", + "'%(alias)s' is not a valid format for an alias": "'%(alias)s' is not a valid format for an alias", + "Invalid address format": "Invalid address format", + "'%(alias)s' is not a valid format for an address": "'%(alias)s' is not a valid format for an address", + "not specified": "not specified", + "not set": "not set", + "Remote addresses for this room:": "Remote addresses for this room:", + "Addresses": "Addresses", + "The main address for this room is": "The main address for this room is", + "Local addresses for this room:": "Local addresses for this room:", + "This room has no local addresses": "This room has no local addresses", + "New address (e.g. #foo:%(localDomain)s)": "New address (e.g. #foo:%(localDomain)s)", + "Invalid community ID": "Invalid community ID", + "'%(groupId)s' is not a valid community ID": "'%(groupId)s' is not a valid community ID", + "Flair": "Flair", + "Showing flair for these communities:": "Showing flair for these communities:", + "This room is not showing flair for any communities": "This room is not showing flair for any communities", + "New community ID (e.g. +foo:%(localDomain)s)": "New community ID (e.g. +foo:%(localDomain)s)", + "You have enabled URL previews by default.": "You have enabled URL previews by default.", + "You have disabled URL previews by default.": "You have disabled URL previews by default.", + "URL previews are enabled by default for participants in this room.": "URL previews are enabled by default for participants in this room.", + "URL previews are disabled by default for participants in this room.": "URL previews are disabled by default for participants in this room.", + "URL Previews": "URL Previews", "Error decrypting audio": "Error decrypting audio", "Error decrypting attachment": "Error decrypting attachment", "Decrypt %(text)s": "Decrypt %(text)s", @@ -763,10 +762,11 @@ "Failed to update community": "Failed to update community", "Unable to accept invite": "Unable to accept invite", "Unable to reject invite": "Unable to reject invite", + "Unable to join community": "Unable to join community", "Leave Community": "Leave Community", "Leave %(groupName)s?": "Leave %(groupName)s?", "Leave": "Leave", - "Unable to leave room": "Unable to leave room", + "Unable to leave community": "Unable to leave community", "Community Settings": "Community Settings", "Changes made to your community might not be seen by other users for up to 30 minutes.": "Changes made to your community might not be seen by other users for up to 30 minutes.", "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.", @@ -774,8 +774,10 @@ "Featured Rooms:": "Featured Rooms:", "Featured Users:": "Featured Users:", "%(inviter)s has invited you to join this community": "%(inviter)s has invited you to join this community", + "Join this community": "Join this community", "You are an administrator of this community": "You are an administrator of this community", "You are a member of this community": "You are a member of this community", + "Leave this community": "Leave this community", "Your community hasn't got a Long Description, a HTML page to show to community members.
Click here to open settings and give it one!": "Your community hasn't got a Long Description, a HTML page to show to community members.
Click here to open settings and give it one!", "Long Description (HTML)": "Long Description (HTML)", "Description": "Description", From c4322892de70e9c819a0912a0aefc62089e24357 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 29 Mar 2018 14:33:54 +0100 Subject: [PATCH 8/9] Reword group setting delay --- src/components/structures/GroupView.js | 10 ++++++++-- src/i18n/strings/en_EN.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 2b5b3d5353..8addb190d8 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -708,8 +708,14 @@ export default React.createClass({ const header = this.state.editing ?

{ _t('Community Settings') }

:
; const changeDelayWarning = this.state.editing && this.state.isUserPrivileged ?
- { _t( 'Changes made to your community might not be seen by other users ' + - 'for up to 30 minutes.', + { _t( + 'Changes made to your community name and avatar ' + + 'might not be seen by other users for up to 30 minutes.', + {}, + { + 'bold1': (sub) => { sub } , + 'bold2': (sub) => { sub } , + }, ) }
:
; return
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 2d3ef836e0..48480ed2a9 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -768,7 +768,7 @@ "Leave": "Leave", "Unable to leave room": "Unable to leave room", "Community Settings": "Community Settings", - "Changes made to your community might not be seen by other users for up to 30 minutes.": "Changes made to your community might not be seen by other users for up to 30 minutes.", + "Changes made to your community name and avatar might not be seen by other users for up to 30 minutes.": "Changes made to your community name and avatar might not be seen by other users for up to 30 minutes.", "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.", "Add rooms to this community": "Add rooms to this community", "Featured Rooms:": "Featured Rooms:", From d6b3083c2f16f55b1400be2d154e35b645c3c730 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 29 Mar 2018 18:18:53 +0100 Subject: [PATCH 9/9] Don't notify for bad encrypted messages Continue to wait for decryption if the decryption process failed. Because we weren't doing this, the first message in a megolm session was generally failing to decrypt the first time because the keys often arrive after the message. Fixes https://github.com/vector-im/riot-web/issues/6284 This is is small & safe enough that we may want to consider putting it in 0.14 if we're cutting another RC. --- src/Notifier.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Notifier.js b/src/Notifier.js index e69bdf4461..b823c4df05 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -256,6 +256,10 @@ const Notifier = { }, onEventDecrypted: function(ev) { + // 'decrypted' means the decryption process has finished: it may have failed, + // in which case it might decrypt soon if the keys arrive + if (ev.isDecryptionFailure()) return; + const idx = this.pendingEncryptedEventIds.indexOf(ev.getId()); if (idx === -1) return;