From bf0e1efce8441d8b8bd06243255617da76a11ffc Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 24 Jan 2020 17:53:30 +0000 Subject: [PATCH] Hide default encryption algorithm When the default encryption algorithm is used, we hide it to remove some jargon from the app. For any other algorithm, we continue showing it and add "unrecognised". Fixes https://github.com/vector-im/riot-web/issues/8829 --- src/TextForEvent.js | 17 +++++++++++++---- src/i18n/strings/en_EN.json | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 6a2744109b..cdfea45ad7 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -444,10 +444,19 @@ function textForHistoryVisibilityEvent(event) { function textForEncryptionEvent(event) { const senderName = event.sender ? event.sender.name : event.getSender(); - return _t('%(senderName)s turned on end-to-end encryption (algorithm %(algorithm)s).', { - senderName, - algorithm: event.getContent().algorithm, - }); + if (event.getContent().algorithm === "m.megolm.v1.aes-sha2") { + return _t('%(senderName)s turned on end-to-end encryption.', { + senderName, + }); + } + return _t( + '%(senderName)s turned on end-to-end encryption ' + + '(unrecognised algorithm %(algorithm)s).', + { + senderName, + algorithm: event.getContent().algorithm, + }, + ); } // Currently will only display a change if a user's power level is changed diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index c3ad3d1901..79f5731aed 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -256,7 +256,8 @@ "%(senderName)s made future room history visible to all room members.": "%(senderName)s made future room history visible to all room members.", "%(senderName)s made future room history visible to anyone.": "%(senderName)s made future room history visible to anyone.", "%(senderName)s made future room history visible to unknown (%(visibility)s).": "%(senderName)s made future room history visible to unknown (%(visibility)s).", - "%(senderName)s turned on end-to-end encryption (algorithm %(algorithm)s).": "%(senderName)s turned on end-to-end encryption (algorithm %(algorithm)s).", + "%(senderName)s turned on end-to-end encryption.": "%(senderName)s turned on end-to-end encryption.", + "%(senderName)s turned on end-to-end encryption (unrecognised algorithm %(algorithm)s).": "%(senderName)s turned on end-to-end encryption (unrecognised algorithm %(algorithm)s).", "%(userId)s from %(fromPowerLevel)s to %(toPowerLevel)s": "%(userId)s from %(fromPowerLevel)s to %(toPowerLevel)s", "%(senderName)s changed the power level of %(powerLevelDiffText)s.": "%(senderName)s changed the power level of %(powerLevelDiffText)s.", "%(senderName)s changed the pinned messages for the room.": "%(senderName)s changed the pinned messages for the room.",