mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
Merge pull request #5191 from matrix-org/dbkr/jitsi_call_naming
Call jitsi widgets 'group calls'
This commit is contained in:
commit
de8865d844
2 changed files with 26 additions and 0 deletions
|
@ -19,6 +19,7 @@ import { _t } from './languageHandler';
|
|||
import * as Roles from './Roles';
|
||||
import {isValid3pidInvite} from "./RoomInvite";
|
||||
import SettingsStore from "./settings/SettingsStore";
|
||||
import {WidgetType} from "./widgets/WidgetType";
|
||||
import {ALL_RULE_TYPES, ROOM_RULE_TYPES, SERVER_RULE_TYPES, USER_RULE_TYPES} from "./mjolnir/BanList";
|
||||
|
||||
function textForMemberEvent(ev) {
|
||||
|
@ -475,6 +476,10 @@ function textForWidgetEvent(event) {
|
|||
const {name: prevName, type: prevType, url: prevUrl} = event.getPrevContent();
|
||||
const {name, type, url} = event.getContent() || {};
|
||||
|
||||
if (WidgetType.JITSI.matches(type) || WidgetType.JITSI.matches(prevType)) {
|
||||
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 +505,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();
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue