1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Allow sending notification events when starting a call (#4826)

* Make it easier to mock call memberships for specific user IDs

* Allow sending notification events when starting a call

* rename notify -> notification

* replace `joining` concept with `ownMembership`

* introduce new `m.rtc.notification` event alongside `m.call.notify`

* send new notification event alongside the deprecated one

* Test for new notification event type

* update relation string to match msc

* review

* fix doc errors

* fix tests + format

* remove anything decline related

---------

Co-authored-by: Timo <toger5@hotmail.de>
This commit is contained in:
Robin
2025-07-18 08:42:57 -04:00
committed by GitHub
parent f8f1bf3837
commit aa79236ce2
10 changed files with 208 additions and 71 deletions

View File

@@ -221,7 +221,13 @@ export class MembershipManager
public async onRTCSessionMemberUpdate(memberships: CallMembership[]): Promise<void> {
const userId = this.client.getUserId();
const deviceId = this.client.getDeviceId();
if (userId && deviceId && this.isJoined() && !memberships.some((m) => isMyMembership(m, userId, deviceId))) {
if (!userId || !deviceId) {
this.logger.error("MembershipManager.onRTCSessionMemberUpdate called without user or device id");
return Promise.resolve();
}
this._ownMembership = memberships.find((m) => isMyMembership(m, userId, deviceId));
if (this.isActivated() && !this._ownMembership) {
// If one of these actions are scheduled or are getting inserted in the next iteration, we should already
// take care of our missing membership.
const sendingMembershipActions = [
@@ -310,6 +316,11 @@ export class MembershipManager
}, this.logger);
}
private _ownMembership?: CallMembership;
public get ownMembership(): CallMembership | undefined {
return this._ownMembership;
}
// scheduler
private oldStatus?: Status;
private scheduler: ActionScheduler;