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

Commit cecc5f1

Browse files
committed
Allow users to join calls and video rooms without joining the beta
With this change, joining the beta is only necessary to start a group call or create a video room. This change will not land until after Element Call has been promoted into beta.
1 parent a63da74 commit cecc5f1

File tree

11 files changed

+23
-74
lines changed

11 files changed

+23
-74
lines changed

src/Notifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ export const Notifier = {
505505
* Some events require special handling such as showing in-app toasts
506506
*/
507507
_performCustomEventHandling: function (ev: MatrixEvent) {
508-
if (ElementCall.CALL_EVENT_TYPE.names.includes(ev.getType()) && SettingsStore.getValue("feature_group_calls")) {
508+
if (ElementCall.CALL_EVENT_TYPE.names.includes(ev.getType())) {
509509
ToastStore.sharedInstance().addOrReplaceToast({
510510
key: getIncomingCallToastKey(ev.getStateKey()),
511511
priority: 100,

src/components/structures/RoomView.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
506506
};
507507

508508
private getMainSplitContentType = (room: Room): MainSplitContentType => {
509-
if (
510-
(SettingsStore.getValue("feature_group_calls") && this.context.roomViewStore.isViewingCall()) ||
511-
isVideoRoom(room)
512-
) {
509+
if (this.context.roomViewStore.isViewingCall() || isVideoRoom(room)) {
513510
return MainSplitContentType.Call;
514511
}
515512
if (this.context.widgetLayoutStore.hasMaximisedWidget(room)) {
@@ -1931,10 +1928,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
19311928
}
19321929

19331930
const myMembership = this.state.room.getMyMembership();
1934-
if (
1935-
isVideoRoom(this.state.room) &&
1936-
!(SettingsStore.getValue("feature_video_rooms") && myMembership === "join")
1937-
) {
1931+
if (isVideoRoom(this.state.room) && myMembership !== "join") {
19381932
return (
19391933
<ErrorBoundary>
19401934
<div className="mx_MainSplit">
@@ -1944,7 +1938,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
19441938
onRejectButtonClicked={this.onRejectButtonClicked}
19451939
/>
19461940
</div>
1947-
;
19481941
</ErrorBoundary>
19491942
);
19501943
}

src/components/views/context_menus/RoomContextMenu.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts";
5050
import SettingsStore from "../../../settings/SettingsStore";
5151
import DevtoolsDialog from "../dialogs/DevtoolsDialog";
5252
import { SdkContextClass } from "../../../contexts/SDKContext";
53+
import { isVideoRoom as calcIsVideoRoom } from "../../../utils/video-rooms";
5354

5455
interface IProps extends IContextMenuProps {
5556
room: Room;
@@ -107,10 +108,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
107108
}
108109

109110
const isDm = DMRoomMap.shared().getUserIdForRoomId(room.roomId);
110-
const videoRoomsEnabled = useFeatureEnabled("feature_video_rooms");
111-
const elementCallVideoRoomsEnabled = useFeatureEnabled("feature_element_call_video_rooms");
112-
const isVideoRoom =
113-
videoRoomsEnabled && (room.isElementVideoRoom() || (elementCallVideoRoomsEnabled && room.isCallRoom()));
111+
const isVideoRoom = calcIsVideoRoom(room);
114112

115113
let inviteOption: JSX.Element;
116114
if (room.canInvite(cli.getUserId()!) && !isDm) {

src/components/views/right_panel/RoomSummaryCard.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import ExportDialog from "../dialogs/ExportDialog";
5151
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
5252
import PosthogTrackers from "../../../PosthogTrackers";
5353
import { shouldShowComponent } from "../../../customisations/helpers/UIComponents";
54+
import { isVideoRoom as calcIsVideoRoom } from "../../../utils/video-rooms";
5455

5556
interface IProps {
5657
room: Room;
@@ -284,10 +285,7 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
284285
const isRoomEncrypted = useIsEncrypted(cli, room);
285286
const roomContext = useContext(RoomContext);
286287
const e2eStatus = roomContext.e2eStatus;
287-
const videoRoomsEnabled = useFeatureEnabled("feature_video_rooms");
288-
const elementCallVideoRoomsEnabled = useFeatureEnabled("feature_element_call_video_rooms");
289-
const isVideoRoom =
290-
videoRoomsEnabled && (room.isElementVideoRoom() || (elementCallVideoRoomsEnabled && room.isCallRoom()));
288+
const isVideoRoom = calcIsVideoRoom(room);
291289

292290
const alias = room.getCanonicalAlias() || room.getAltAliases()[0] || "";
293291
const header = (

src/components/views/rooms/RoomHeader.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import { _t } from "../../../languageHandler";
2828
import defaultDispatcher from "../../../dispatcher/dispatcher";
2929
import { Action } from "../../../dispatcher/actions";
3030
import { UserTab } from "../dialogs/UserTab";
31-
import SettingsStore from "../../../settings/SettingsStore";
3231
import RoomHeaderButtons from "../right_panel/RoomHeaderButtons";
3332
import E2EIcon from "./E2EIcon";
3433
import DecoratedRoomAvatar from "../avatars/DecoratedRoomAvatar";
@@ -247,8 +246,7 @@ const CallButtons: FC<CallButtonsProps> = ({ room }) => {
247246
const [busy, setBusy] = useState(false);
248247
const showButtons = useSettingValue<boolean>("showCallButtonsInComposer");
249248
const groupCallsEnabled = useFeatureEnabled("feature_group_calls");
250-
const videoRoomsEnabled = useFeatureEnabled("feature_video_rooms");
251-
const isVideoRoom = useMemo(() => videoRoomsEnabled && calcIsVideoRoom(room), [videoRoomsEnabled, room]);
249+
const isVideoRoom = useMemo(() => calcIsVideoRoom(room), [room]);
252250
const useElementCallExclusively = useMemo(() => {
253251
return SdkConfig.get("element_call").use_exclusively ?? DEFAULTS.element_call.use_exclusively;
254252
}, []);
@@ -336,7 +334,7 @@ const CallButtons: FC<CallButtonsProps> = ({ room }) => {
336334
</>
337335
);
338336
}
339-
} else if (hasLegacyCall || hasJitsiWidget) {
337+
} else if (hasLegacyCall || hasJitsiWidget || hasGroupCall) {
340338
return (
341339
<>
342340
{makeVoiceCallButton(new DisabledWithReason(_t("Ongoing call")))}
@@ -717,7 +715,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
717715
}
718716

719717
public render(): JSX.Element {
720-
const isVideoRoom = SettingsStore.getValue("feature_video_rooms") && calcIsVideoRoom(this.props.room);
718+
const isVideoRoom = calcIsVideoRoom(this.props.room);
721719

722720
let roomAvatar: JSX.Element | null = null;
723721
if (this.props.room) {

src/components/views/rooms/RoomInfoLine.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
2424
import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases";
2525
import { useAsyncMemo } from "../../../hooks/useAsyncMemo";
2626
import { useRoomState } from "../../../hooks/useRoomState";
27-
import { useFeatureEnabled } from "../../../hooks/useSettings";
2827
import { useRoomMemberCount, useMyRoomMembership } from "../../../hooks/useRoomMembers";
2928
import AccessibleButton from "../elements/AccessibleButton";
29+
import { isVideoRoom } from "../../../utils/video-rooms";
3030

3131
interface IProps {
3232
room: Room;
@@ -46,12 +46,9 @@ const RoomInfoLine: FC<IProps> = ({ room }) => {
4646
const membership = useMyRoomMembership(room);
4747
const memberCount = useRoomMemberCount(room);
4848

49-
const elementCallVideoRoomsEnabled = useFeatureEnabled("feature_element_call_video_rooms");
50-
const isVideoRoom = room.isElementVideoRoom() || (elementCallVideoRoomsEnabled && room.isCallRoom());
51-
5249
let iconClass: string;
5350
let roomType: string;
54-
if (isVideoRoom) {
51+
if (isVideoRoom(room)) {
5552
iconClass = "mx_RoomInfoLine_video";
5653
roomType = _t("Video room");
5754
} else if (joinRule === JoinRule.Public) {

src/components/views/rooms/RoomPreviewCard.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { UserTab } from "../dialogs/UserTab";
2525
import { EffectiveMembership, getEffectiveMembership } from "../../../utils/membership";
2626
import MatrixClientContext from "../../../contexts/MatrixClientContext";
2727
import { useDispatcher } from "../../../hooks/useDispatcher";
28-
import { useFeatureEnabled } from "../../../hooks/useSettings";
2928
import { useRoomState } from "../../../hooks/useRoomState";
3029
import { useMyRoomMembership } from "../../../hooks/useRoomMembers";
3130
import AccessibleButton from "../elements/AccessibleButton";
@@ -37,6 +36,7 @@ import RoomAvatar from "../avatars/RoomAvatar";
3736
import MemberAvatar from "../avatars/MemberAvatar";
3837
import { BetaPill } from "../beta/BetaCard";
3938
import RoomInfoLine from "./RoomInfoLine";
39+
import { isVideoRoom } from "../../../utils/video-rooms";
4040

4141
interface IProps {
4242
room: Room;
@@ -50,9 +50,6 @@ interface IProps {
5050
// and viewing invite reasons to achieve parity with the default invite screen.
5151
const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButtonClicked }) => {
5252
const cli = useContext(MatrixClientContext);
53-
const videoRoomsEnabled = useFeatureEnabled("feature_video_rooms");
54-
const elementCallVideoRoomsEnabled = useFeatureEnabled("feature_element_call_video_rooms");
55-
const isVideoRoom = room.isElementVideoRoom() || (elementCallVideoRoomsEnabled && room.isCallRoom());
5653
const myMembership = useMyRoomMembership(room);
5754
useDispatcher(defaultDispatcher, (payload) => {
5855
if (payload.action === Action.JoinRoomError && payload.roomId === room.roomId) {
@@ -158,7 +155,7 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
158155
}
159156

160157
let avatarRow: JSX.Element;
161-
if (isVideoRoom) {
158+
if (isVideoRoom(room)) {
162159
avatarRow = (
163160
<>
164161
<RoomAvatar room={room} height={50} width={50} viewAvatarOnClick />
@@ -177,17 +174,6 @@ const RoomPreviewCard: FC<IProps> = ({ room, onJoinButtonClicked, onRejectButton
177174
notice = _t("To view %(roomName)s, you need an invite", {
178175
roomName: room.name,
179176
});
180-
} else if (isVideoRoom && !videoRoomsEnabled) {
181-
notice =
182-
myMembership === "join"
183-
? _t("To view, please enable video rooms in Labs first")
184-
: _t("To join, please enable video rooms in Labs first");
185-
186-
joinButtons = (
187-
<AccessibleButton kind="primary" onClick={viewLabs}>
188-
{_t("Show Labs settings")}
189-
</AccessibleButton>
190-
);
191177
}
192178

193179
return (

src/components/views/settings/tabs/room/RolesRoomSettingsTab.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {
245245
const plContent = plEvent ? plEvent.getContent() || {} : {};
246246
const canChangeLevels = room.currentState.mayClientSendStateEvent(EventType.RoomPowerLevels, client);
247247

248-
const plEventsToLabels = {
248+
const plEventsToLabels: { [eventType: string]: string | null } = {
249249
// These will be translated for us later.
250250
[EventType.RoomAvatar]: isSpaceRoom ? _td("Change space avatar") : _td("Change room avatar"),
251251
[EventType.RoomName]: isSpaceRoom ? _td("Change space name") : _td("Change room name"),
@@ -265,16 +265,13 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {
265265
// TODO: Enable support for m.widget event type (https://github.com/vector-im/element-web/issues/13111)
266266
"im.vector.modular.widgets": isSpaceRoom ? null : _td("Modify widgets"),
267267
[VoiceBroadcastInfoEventType]: _td("Voice broadcasts"),
268+
[ElementCall.CALL_EVENT_TYPE.name]: _td("Start %(brand)s calls"),
269+
[ElementCall.MEMBER_EVENT_TYPE.name]: _td("Join %(brand)s calls"),
268270
};
269271

270272
if (SettingsStore.getValue("feature_pinning")) {
271273
plEventsToLabels[EventType.RoomPinnedEvents] = _td("Manage pinned events");
272274
}
273-
// MSC3401: Native Group VoIP signaling
274-
if (SettingsStore.getValue("feature_group_calls")) {
275-
plEventsToLabels[ElementCall.CALL_EVENT_TYPE.name] = _td("Start %(brand)s calls");
276-
plEventsToLabels[ElementCall.MEMBER_EVENT_TYPE.name] = _td("Join %(brand)s calls");
277-
}
278275

279276
const powerLevelDescriptors: Record<string, IPowerLevelDescriptor> = {
280277
"users_default": {

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,9 +1706,9 @@
17061706
"Remove messages sent by me": "Remove messages sent by me",
17071707
"Modify widgets": "Modify widgets",
17081708
"Voice broadcasts": "Voice broadcasts",
1709-
"Manage pinned events": "Manage pinned events",
17101709
"Start %(brand)s calls": "Start %(brand)s calls",
17111710
"Join %(brand)s calls": "Join %(brand)s calls",
1711+
"Manage pinned events": "Manage pinned events",
17121712
"Default role": "Default role",
17131713
"Send messages": "Send messages",
17141714
"Invite users": "Invite users",
@@ -2088,9 +2088,6 @@
20882088
"Leave": "Leave",
20892089
"<inviter/> invites you": "<inviter/> invites you",
20902090
"To view %(roomName)s, you need an invite": "To view %(roomName)s, you need an invite",
2091-
"To view, please enable video rooms in Labs first": "To view, please enable video rooms in Labs first",
2092-
"To join, please enable video rooms in Labs first": "To join, please enable video rooms in Labs first",
2093-
"Show Labs settings": "Show Labs settings",
20942091
"Appearance": "Appearance",
20952092
"Show rooms with unread messages first": "Show rooms with unread messages first",
20962093
"Show previews of messages": "Show previews of messages",

src/models/Call.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class JitsiCall extends Call {
331331

332332
public static get(room: Room): JitsiCall | null {
333333
// Only supported in video rooms
334-
if (SettingsStore.getValue("feature_video_rooms") && room.isElementVideoRoom()) {
334+
if (room.isElementVideoRoom()) {
335335
const apps = WidgetStore.instance.getApps(room.roomId);
336336
// The isVideoChannel field differentiates rich Jitsi calls from bare Jitsi widgets
337337
const jitsiWidget = apps.find((app) => WidgetType.JITSI.matches(app.type) && app.data?.isVideoChannel);
@@ -700,32 +700,19 @@ export class ElementCall extends Call {
700700
}
701701

702702
public static get(room: Room): ElementCall | null {
703-
// Only supported in the new group call experience or in video rooms
704-
if (
705-
SettingsStore.getValue("feature_group_calls") ||
706-
(SettingsStore.getValue("feature_video_rooms") &&
707-
SettingsStore.getValue("feature_element_call_video_rooms") &&
708-
room.isCallRoom())
709-
) {
710-
const groupCall = room.client.groupCallEventHandler!.groupCalls.get(room.roomId);
711-
if (groupCall !== undefined) return new ElementCall(groupCall, room.client);
712-
}
703+
const groupCall = room.client.groupCallEventHandler!.groupCalls.get(room.roomId);
704+
if (groupCall !== undefined) return new ElementCall(groupCall, room.client);
713705

714706
return null;
715707
}
716708

717709
public static async create(room: Room): Promise<void> {
718-
const isVideoRoom =
719-
SettingsStore.getValue("feature_video_rooms") &&
720-
SettingsStore.getValue("feature_element_call_video_rooms") &&
721-
room.isCallRoom();
722-
723710
const groupCall = new GroupCall(
724711
room.client,
725712
room,
726713
GroupCallType.Video,
727714
false,
728-
isVideoRoom ? GroupCallIntent.Room : GroupCallIntent.Prompt,
715+
room.isCallRoom() ? GroupCallIntent.Room : GroupCallIntent.Prompt,
729716
);
730717

731718
await groupCall.create();

0 commit comments

Comments
 (0)