Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add Element Call room settings #9347

Merged
merged 28 commits into from
Oct 7, 2022
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b421911
Correctly setup EC perms on room creation
SimonBrandner Oct 4, 2022
055faf6
Add `VoipRoomSettingsTab`
SimonBrandner Oct 4, 2022
0cdf7ca
Show `VoipRoomSettingsTab`
SimonBrandner Oct 4, 2022
ebcd2d5
Show MSC3401 perms in room settings
SimonBrandner Oct 4, 2022
88c3666
i18n
SimonBrandner Oct 4, 2022
761e528
Remove `ScreenName`
SimonBrandner Oct 4, 2022
adf9f19
Hide behind labs flag
SimonBrandner Oct 4, 2022
b92a576
Add `testid`
SimonBrandner Oct 4, 2022
5491451
Add tests
SimonBrandner Oct 4, 2022
eb8b242
i18n
SimonBrandner Oct 4, 2022
1b19491
Don't mix `"` and `'`
SimonBrandner Oct 5, 2022
1e56fbc
Fix indent
SimonBrandner Oct 5, 2022
278f0fd
Fix test name
SimonBrandner Oct 5, 2022
9983434
Try to use existing power levels
SimonBrandner Oct 5, 2022
d4f0789
Fix MSC number
SimonBrandner Oct 6, 2022
940095b
Fix MSC number
SimonBrandner Oct 6, 2022
deabd80
Gate behind flag
SimonBrandner Oct 6, 2022
512b07a
Add missing `DEFAULT_EVENT_POWER_LEVELS`
SimonBrandner Oct 6, 2022
938498f
Mock `SettingsStore`
SimonBrandner Oct 6, 2022
2a6bbda
Disable when insufficient perms
SimonBrandner Oct 6, 2022
756bdaf
Fix tests
SimonBrandner Oct 6, 2022
14d9bab
Don't cast as `any`
SimonBrandner Oct 7, 2022
b62e74b
Merge branch 'develop' into SimonBrandner/feat/ec-perms
SimonBrandner Oct 7, 2022
2bcdbf7
Add EC brand
SimonBrandner Oct 7, 2022
e7000b6
i18n
SimonBrandner Oct 7, 2022
d5ee3d6
Delint
SimonBrandner Oct 7, 2022
dfd4031
Fix tests
SimonBrandner Oct 7, 2022
e19e015
Merge branch 'develop' into SimonBrandner/feat/ec-perms
SimonBrandner Oct 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add EC brand
Signed-off-by: Šimon Brandner <[email protected]>
SimonBrandner committed Oct 7, 2022

Verified

This commit was signed with the committer’s verified signature.
SimonBrandner Šimon Brandner
commit 2bcdbf76e8f6f7a90ddc106f607ac8f4888cf5d4
1 change: 1 addition & 0 deletions src/IConfigOptions.ts
Original file line number Diff line number Diff line change
@@ -119,6 +119,7 @@ export interface IConfigOptions {
element_call: {
url: string;
use_exclusively: boolean;
brand: string;
};

logout_redirect_url?: string;
1 change: 1 addition & 0 deletions src/SdkConfig.ts
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ export const DEFAULTS: IConfigOptions = {
element_call: {
url: "https://call.element.io",
use_exclusively: false,
brand: "Element Call",
},

// @ts-ignore - we deliberately use the camelCase version here so we trigger
3 changes: 2 additions & 1 deletion src/components/views/rooms/RoomHeader.tsx
Original file line number Diff line number Diff line change
@@ -195,10 +195,11 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
let menu: JSX.Element | null = null;
if (menuOpen) {
const buttonRect = buttonRef.current!.getBoundingClientRect();
const brand = SdkConfig.get("element_call").brand;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an error waiting to happen: we should be using SdkConfig.get().element_call?.brand ?? DEFAULTS.element_call.brand instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed by #9376

menu = <IconizedContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu}>
<IconizedContextMenuOptionList>
<IconizedContextMenuOption label={_t("Video call (Jitsi)")} onClick={onJitsiClick} />
<IconizedContextMenuOption label={_t("Video call (Element Call)")} onClick={onElementClick} />
<IconizedContextMenuOption label={_t("Video call (%(brand)s)", { brand })} onClick={onElementClick} />
</IconizedContextMenuOptionList>
</IconizedContextMenu>;
}
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ import SettingsFieldset from '../../SettingsFieldset';
import SettingsStore from "../../../../../settings/SettingsStore";
import { VoiceBroadcastInfoEventType } from '../../../../../voice-broadcast';
import { ElementCall } from "../../../../../models/Call";
import SdkConfig from "../../../../../SdkConfig";

interface IEventShowOpts {
isState?: boolean;
@@ -259,8 +260,8 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {
}
// MSC3401: Native Group VoIP signaling
if (SettingsStore.getValue("feature_group_calls")) {
plEventsToLabels[ElementCall.CALL_EVENT_TYPE.name] = _td("Start Element calls");
plEventsToLabels[ElementCall.MEMBER_EVENT_TYPE.name] = _td("Join Element calls");
plEventsToLabels[ElementCall.CALL_EVENT_TYPE.name] = _td("Start %(brand)s calls");
plEventsToLabels[ElementCall.MEMBER_EVENT_TYPE.name] = _td("Join %(brand)s calls");
}

const powerLevelDescriptors: Record<string, IPowerLevelDescriptor> = {
@@ -445,7 +446,8 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {

let label = plEventsToLabels[eventType];
if (label) {
label = _t(label);
const brand = SdkConfig.get("element_call").brand;
label = _t(label, { brand });
} else {
label = _t("Send %(eventType)s events", { eventType });
}
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ import SettingsSubsection from "../../shared/SettingsSubsection";
import SettingsTab from "../SettingsTab";
import { ElementCall } from "../../../../../models/Call";
import { useRoomState } from "../../../../../hooks/useRoomState";
import SdkConfig from "../../../../../SdkConfig";

interface ElementCallSwitchProps {
roomId: string;
@@ -68,12 +69,15 @@ const ElementCallSwitch: React.FC<ElementCallSwitchProps> = ({ roomId }) => {
});
}, [roomId, content, events, isPublic]);

const brand = SdkConfig.get("element_call").brand;

return <LabelledToggleSwitch
data-testid="element-call-switch"
label={_t("Enable Element Call as an additional calling option in this room")}
label={_t("Enable %(brand)s as an additional calling option in this room", { brand })}
caption={_t(
"Element Call is end-to-end encrypted, " +
"%(brand)s is end-to-end encrypted, " +
"but is currently limited to smaller numbers of users.",
{ brand },
)}
value={elementCallEnabled}
onChange={onChange}