From d9d25e26d27fde690502a3830acaeb91dd300157 Mon Sep 17 00:00:00 2001 From: turt2live Date: Mon, 29 May 2017 23:21:14 -0600 Subject: [PATCH] Say "X removed the room name" instead of showing nothing Addresses vector-im/riot-web#4072 Signed-off-by: Travis Ralston --- src/TextForEvent.js | 5 ++++- src/i18n/strings/en_EN.json | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 6438a9a1ad..fa78f9d61b 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -117,7 +117,10 @@ function textForTopicEvent(ev) { function textForRoomNameEvent(ev) { var senderDisplayName = ev.sender && ev.sender.name ? ev.sender.name : ev.getSender(); - + + if (!ev.getContent().name || ev.getContent().name.trim().length === 0) { + return _t('%(senderDisplayName)s removed the room name.', {senderDisplayName: senderDisplayName}); + } return _t('%(senderDisplayName)s changed the room name to %(roomName)s.', {senderDisplayName: senderDisplayName, roomName: ev.getContent().name}); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 5abb27e2b7..527219b4a6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -174,6 +174,7 @@ "%(senderName)s changed their profile picture.": "%(senderName)s changed their profile picture.", "%(senderName)s changed the power level of %(powerLevelDiffText)s.": "%(senderName)s changed the power level of %(powerLevelDiffText)s.", "%(senderDisplayName)s changed the room name to %(roomName)s.": "%(senderDisplayName)s changed the room name to %(roomName)s.", + "%(senderDisplayName)s removed the room name.": "%(senderDisplayName)s removed the room name.", "%(senderDisplayName)s changed the topic to \"%(topic)s\".": "%(senderDisplayName)s changed the topic to \"%(topic)s\".", "Changes to who can read history will only apply to future messages in this room": "Changes to who can read history will only apply to future messages in this room", "Changes your display nickname": "Changes your display nickname",