From b678c2cf0f1166ab1a087d2508c2f99da186d37c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 Aug 2017 17:15:27 +0100 Subject: [PATCH 1/3] Don't bind Pill function, React does this for us --- src/components/views/elements/Pill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/Pill.js b/src/components/views/elements/Pill.js index 7dee5f6a40..214abc2329 100644 --- a/src/components/views/elements/Pill.js +++ b/src/components/views/elements/Pill.js @@ -171,7 +171,7 @@ const Pill = React.createClass({ } pillClass = 'mx_UserPill'; href = null; - onClick = this.onUserPillClicked.bind(this); + onClick = this.onUserPillClicked; } } break; From 7395f96b77a6c8876f760fb0b91455045ab7f566 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 18 Aug 2017 18:02:50 +0100 Subject: [PATCH 2/3] Rearrange timeline update wording for better internationalisation. Fix widget name values. --- src/TextForEvent.js | 15 +++++++++------ src/i18n/strings/en_EN.json | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 13870f966c..95066912ac 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -252,18 +252,21 @@ function textForWidgetEvent(event) { const senderName = event.sender ? event.sender.name : event.getSender(); const previousContent = event.getPrevContent() || {}; const {name, type, url} = event.getContent() || {}; - let widgetName = widgetName || name || type || previousContent.type; - widgetName = widgetName ? widgetName + ' ' : ''; + let widgetName = name || previousContent.name || type || previousContent.type || ''; + // Apply sentence case to widget name + if (widgetName && widgetName.length > 0) { + widgetName = widgetName[0].toUpperCase() + widgetName.slice(1) + ' '; + } // If the widget was removed, its content should be {}, but this is sufficiently // equivalent to that condition. if (url) { - return _t('%(senderName)s added a %(widgetName)swidget', { - senderName, widgetName, + return _t('%(widgetName)s widget added by %(senderName)s', { + widgetName, senderName, }); } else { - return _t('%(senderName)s removed a %(widgetName)swidget', { - senderName, widgetName, + return _t('%(widgetName)s widget removed by %(senderName)s', { + widgetName, senderName, }); } } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index aa4f71fcb3..c3ac9e7023 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -972,7 +972,7 @@ "Failed to upload image": "Failed to upload image", "Failed to update group": "Failed to update group", "Hide avatars in user and room mentions": "Hide avatars in user and room mentions", - "%(senderName)s added a %(widgetName)swidget": "%(senderName)s added a %(widgetName)swidget", - "%(senderName)s removed a %(widgetName)swidget": "%(senderName)s removed a %(widgetName)swidget", + "%(widgetName)s widget added by %(senderName)s": "%(widgetName)s widget added by %(senderName)s", + "%(widgetName)s widget removed by %(senderName)s": "%(widgetName)s widget removed by %(senderName)s", "Robot check is currently unavailable on desktop - please use a web browser": "Robot check is currently unavailable on desktop - please use a web browser" } From 1862057695fdc734d6b30c0af382d278a81f1c1c Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 18 Aug 2017 18:33:56 +0100 Subject: [PATCH 3/3] Only render appTile body (including warnings) if drawer shown. --- src/components/views/elements/AppTile.js | 62 ++++++++++++------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index a411e1d6f6..a4d89df207 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -223,42 +223,44 @@ export default React.createClass({ safeWidgetUrl = url.format(parsedWidgetUrl); } - if (this.state.loading) { - appTileBody = ( -
- -
- ); - } else if (this.state.hasPermissionToLoad == true) { - if (this.isMixedContent()) { + if (this.props.show) { + if (this.state.loading) { + appTileBody = ( +
+ +
+ ); + } else if (this.state.hasPermissionToLoad == true) { + if (this.isMixedContent()) { + appTileBody = ( +
+ +
+ ); + } else { + appTileBody = ( +
+ +
+ ); + } + } else { appTileBody = (
-
); - } else if (this.props.show) { - appTileBody = ( -
- -
- ); } - } else { - appTileBody = ( -
- -
- ); } // editing is done in scalar