From 2b965a2741ba5a6b87adacd7d8c6d633b4a4bfcb Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 10 Sep 2020 11:52:01 +0100 Subject: [PATCH] Call jitsi widgets 'group calls' So they feel a bit more like first class citizens --- src/TextForEvent.js | 22 ++++++++++++++++++++++ src/i18n/strings/en_EN.json | 3 +++ 2 files changed, 25 insertions(+) diff --git a/src/TextForEvent.js b/src/TextForEvent.js index c55380bd9b..084459c72e 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -475,6 +475,10 @@ function textForWidgetEvent(event) { const {name: prevName, type: prevType, url: prevUrl} = event.getPrevContent(); const {name, type, url} = event.getContent() || {}; + if (type === 'jitsi' || prevType === 'jitsi') { + return textForJitsiWidgetEvent(event, senderName, url, prevUrl); + } + let widgetName = name || prevName || type || prevType || ''; // Apply sentence case to widget name if (widgetName && widgetName.length > 0) { @@ -500,6 +504,24 @@ function textForWidgetEvent(event) { } } +function textForJitsiWidgetEvent(event, senderName, url, prevUrl) { + if (url) { + if (prevUrl) { + return _t('Group call modified by %(senderName)s', { + senderName, + }); + } else { + return _t('Group call started by %(senderName)s', { + senderName, + }); + } + } else { + return _t('Group call ended by %(senderName)s', { + senderName, + }); + } +} + function textForMjolnirEvent(event) { const senderName = event.getSender(); const {entity: prevEntity} = event.getPrevContent(); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 77cd8ef661..afa2888ec5 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -278,6 +278,9 @@ "%(widgetName)s widget modified by %(senderName)s": "%(widgetName)s widget modified by %(senderName)s", "%(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", + "Group call modified by %(senderName)s": "Group call modified by %(senderName)s", + "Group call started by %(senderName)s": "Group call started by %(senderName)s", + "Group call ended by %(senderName)s": "Group call ended by %(senderName)s", "%(senderName)s removed the rule banning users matching %(glob)s": "%(senderName)s removed the rule banning users matching %(glob)s", "%(senderName)s removed the rule banning rooms matching %(glob)s": "%(senderName)s removed the rule banning rooms matching %(glob)s", "%(senderName)s removed the rule banning servers matching %(glob)s": "%(senderName)s removed the rule banning servers matching %(glob)s",