From 5990e41bd74264c590ec8ccf2b0d4272134f8e24 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 25 Oct 2017 17:24:45 +0100 Subject: [PATCH 1/2] Use the correct userId when displaying who redacted a message --- src/components/views/messages/UnknownBody.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/messages/UnknownBody.js b/src/components/views/messages/UnknownBody.js index 083d7ac12e..5a2bf7c54c 100644 --- a/src/components/views/messages/UnknownBody.js +++ b/src/components/views/messages/UnknownBody.js @@ -25,7 +25,9 @@ module.exports = React.createClass({ render: function() { let tooltip = _t("Removed or unknown message type"); if (this.props.mxEvent.isRedacted()) { - tooltip = _t("Message removed by %(userId)s", {userId: this.props.mxEvent.getSender()}); + tooltip = _t("Message removed by %(userId)s", { + userId: this.props.mxEvent.getUnsigned().redacted_because.sender, + }); } const text = this.props.mxEvent.getContent().body; From cedc0b27a939781bcfa65a2c52197cdb376c338c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 25 Oct 2017 17:37:20 +0100 Subject: [PATCH 2/2] Handle redaction with no sender --- src/components/views/messages/UnknownBody.js | 7 ++++--- src/i18n/strings/en_EN.json | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/views/messages/UnknownBody.js b/src/components/views/messages/UnknownBody.js index 5a2bf7c54c..9a172baf7c 100644 --- a/src/components/views/messages/UnknownBody.js +++ b/src/components/views/messages/UnknownBody.js @@ -25,9 +25,10 @@ module.exports = React.createClass({ render: function() { let tooltip = _t("Removed or unknown message type"); if (this.props.mxEvent.isRedacted()) { - tooltip = _t("Message removed by %(userId)s", { - userId: this.props.mxEvent.getUnsigned().redacted_because.sender, - }); + const redactedBecauseUserId = this.props.mxEvent.getUnsigned().redacted_because.sender; + tooltip = redactedBecauseUserId ? + _t("Message removed by %(userId)s", { userId: redactedBecauseUserId }) : + _t("Message removed"); } const text = this.props.mxEvent.getContent().body; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index ef915f23cd..fbff51299a 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -200,8 +200,6 @@ "Authentication": "Authentication", "Failed to delete device": "Failed to delete device", "Delete": "Delete", - "Delete Widget": "Delete Widget", - "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?": "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?", "Disable Notifications": "Disable Notifications", "Enable Notifications": "Enable Notifications", "Cannot add any more widgets": "Cannot add any more widgets", @@ -452,6 +450,7 @@ "You are about to be taken to a third-party site so you can authenticate your account for use with %(integrationsUrl)s. Do you wish to continue?": "You are about to be taken to a third-party site so you can authenticate your account for use with %(integrationsUrl)s. Do you wish to continue?", "Removed or unknown message type": "Removed or unknown message type", "Message removed by %(userId)s": "Message removed by %(userId)s", + "Message removed": "Message removed", "Robot check is currently unavailable on desktop - please use a web browser": "Robot check is currently unavailable on desktop - please use a web browser", "This Home Server would like to make sure you are not a robot": "This Home Server would like to make sure you are not a robot", "Sign in with CAS": "Sign in with CAS", @@ -499,6 +498,8 @@ "NOTE: Apps are not end-to-end encrypted": "NOTE: Apps are not end-to-end encrypted", "Do you want to load widget from URL:": "Do you want to load widget from URL:", "Allow": "Allow", + "Delete Widget": "Delete Widget", + "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?": "Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?", "Delete widget": "Delete widget", "Revoke widget access": "Revoke widget access", "Edit": "Edit", @@ -678,17 +679,17 @@ "Leave %(groupName)s?": "Leave %(groupName)s?", "Leave": "Leave", "Unable to leave room": "Unable to leave room", + "Community Settings": "Community Settings", "Add rooms to this community": "Add rooms to this community", "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", - "You are a member of this community": "You are a member of 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", "Community Member Settings": "Community Member Settings", "Publish this community on your profile": "Publish this community on your profile", "Long Description (HTML)": "Long Description (HTML)", "Description": "Description", - "Community Settings": "Community Settings", "Community %(groupId)s not found": "Community %(groupId)s not found", "This Home server does not support communities": "This Home server does not support communities", "Failed to load %(groupId)s": "Failed to load %(groupId)s",