From 55f4f1723d76287b0d6764a9f641e9b17e60f2d8 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 27 Jun 2018 11:44:11 +0100
Subject: [PATCH 1/3] fix nullguard on EventTile, getComponent never returns
falsey, it throws
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/rooms/EventTile.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js
index 7f376502d7..9b8aae9726 100644
--- a/src/components/views/rooms/EventTile.js
+++ b/src/components/views/rooms/EventTile.js
@@ -484,12 +484,14 @@ module.exports = withMatrixClient(React.createClass({
// Info messages are basically information about commands processed on a room
const isInfoMessage = (eventType !== 'm.room.message' && eventType !== 'm.sticker');
- const EventTileType = sdk.getComponent(getHandlerTile(this.props.mxEvent));
+ const tileHandler = getHandlerTile(this.props.mxEvent);
// This shouldn't happen: the caller should check we support this type
// before trying to instantiate us
- if (!EventTileType) {
- throw new Error("Event type not supported");
+ if (!tileHandler) {
+ const {mxEvent} = this.props;
+ throw new Error(`Event type not supported: type:${mxEvent.getType()} isState:${mxEvent.isState()}`);
}
+ const EventTileType = sdk.getComponent(tileHandler);
const isSending = (['sending', 'queued', 'encrypting'].indexOf(this.props.eventSendStatus) !== -1);
const isRedacted = isMessageEvent(this.props.mxEvent) && this.props.isRedacted;
From 322b77b57f6407b59822b5b885c66b9c97aec80d Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 29 Jun 2018 12:54:36 +0100
Subject: [PATCH 2/3] don't throw, console.warn + dummy render instead
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/rooms/EventTile.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js
index 9b8aae9726..76c808f0fd 100644
--- a/src/components/views/rooms/EventTile.js
+++ b/src/components/views/rooms/EventTile.js
@@ -489,7 +489,12 @@ module.exports = withMatrixClient(React.createClass({
// before trying to instantiate us
if (!tileHandler) {
const {mxEvent} = this.props;
- throw new Error(`Event type not supported: type:${mxEvent.getType()} isState:${mxEvent.isState()}`);
+ console.warn(`Event type not supported: type:${mxEvent.getType()} isState:${mxEvent.isState()}`);
+ return
+
+ { _t('This event could not be displayed') }
+
+
;
}
const EventTileType = sdk.getComponent(tileHandler);
From f9b3e40bfa3a63295d6855a2a344546ffdf454dc Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Fri, 29 Jun 2018 12:54:54 +0100
Subject: [PATCH 3/3] run gen-i18n and prune-i18n
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/i18n/strings/en_EN.json | 65 +++++++++++++++++++------------------
1 file changed, 33 insertions(+), 32 deletions(-)
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index b18d167ea4..9b9d566831 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -44,6 +44,10 @@
"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",
@@ -83,6 +87,7 @@
"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",
@@ -196,11 +201,6 @@
"%(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?",
@@ -313,6 +313,31 @@
"Off": "Off",
"On": "On",
"Noisy": "Noisy",
+ "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.",
+ "In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.": "In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.",
+ "URL Previews": "URL Previews",
+ "When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.": "When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.",
"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",
@@ -321,6 +346,7 @@
" (unsupported)": " (unsupported)",
"Join as voice or video.": "Join as voice or video.",
"Ongoing conference call%(supportedText)s.": "Ongoing conference call%(supportedText)s.",
+ "This event could not be displayed": "This event could not be displayed",
"%(senderName)s sent an image": "%(senderName)s sent an image",
"%(senderName)s sent a video": "%(senderName)s sent a video",
"%(senderName)s uploaded a file": "%(senderName)s uploaded a file",
@@ -412,11 +438,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",
@@ -550,31 +576,6 @@
"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.",
- "In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.": "In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.",
- "URL Previews": "URL Previews",
- "When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.": "When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.",
"Sunday": "Sunday",
"Monday": "Monday",
"Tuesday": "Tuesday",