Skip to content
Merged
Changes from 5 commits
Commits
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
28 changes: 22 additions & 6 deletions src/models/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import SdkConfig from "../SdkConfig.ts";
import RoomListStore from "../stores/room-list/RoomListStore.ts";
import { DefaultTagID } from "../stores/room-list/models.ts";
import { getJoinedNonFunctionalMembers } from "../utils/room/getJoinedNonFunctionalMembers.ts";

Check failure on line 48 in src/models/Call.ts

View workflow job for this annotation

GitHub Actions / Typescript Syntax Check

'getJoinedNonFunctionalMembers' is declared but its value is never read.

Check failure on line 48 in src/models/Call.ts

View workflow job for this annotation

GitHub Actions / ESLint

'getJoinedNonFunctionalMembers' is defined but never used

const TIMEOUT_MS = 16000;

Expand Down Expand Up @@ -542,6 +543,13 @@
};
}

export enum ElementCallIntent {
StartCall = "start_call",
JoinExisting = "join_existing",
StartCallDM = "start_call_dm",
JoinExistingDM = "join_existing_dm",
}

/**
* A group call using MSC3401 and Element Call as a backend.
* (somewhat cheekily named)
Expand Down Expand Up @@ -586,10 +594,18 @@

const room = client.getRoom(roomId);
if (room !== null && !isVideoRoom(room)) {
params.append(
"sendNotificationType",
RoomListStore.instance.getTagsForRoom(room).includes(DefaultTagID.DM) ? "ring" : "notification",
);
const isDM = RoomListStore.instance.getTagsForRoom(room).includes(DefaultTagID.DM);
params.append("sendNotificationType", isDM ? "ring" : "notification");
if (isDM) {
const oldestMembership = client.matrixRTC.getRoomSession(room).getOldestMembership();

Check failure on line 600 in src/models/Call.ts

View workflow job for this annotation

GitHub Actions / Jest (1)

ElementCall › get › requests ringing notifications in DMs

TypeError: client.matrixRTC.getRoomSession(...).getOldestMembership is not a function at Function.getOldestMembership [as generateWidgetUrl] (src/models/Call.ts:600:80) at Function.generateWidgetUrl [as createOrGetCallWidget] (src/models/Call.ts:693:33) at Function.createOrGetCallWidget [as create] (src/models/Call.ts:782:21) at Object.create (test/unit-tests/models/Call-test.ts:757:29)
if (!oldestMembership) {
// We are starting a call
params.append("intent", ElementCallIntent.StartCallDM);
} else if (oldestMembership.sender !== client.getSafeUserId()) {
// We are joining a call.
params.append("intent", ElementCallIntent.JoinExistingDM);
} // else, don't set an intent.
}
}

const rageshakeSubmitUrl = SdkConfig.get("bug_report_endpoint_url");
Expand Down Expand Up @@ -688,8 +704,8 @@
roomId,
{},
{
skipLobby: skipLobby ?? false,
returnToLobby: returnToLobby ?? false,
skipLobby: skipLobby,
Copy link
Member Author

Choose a reason for hiding this comment

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

As per convo, I think these should be undefined if unused.

returnToLobby: returnToLobby,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is for video rooms right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, and I think we can revert this change tbh. Let's leave in the defaults and look at this on the toasts PR.

},
),
},
Expand Down
Loading