Align widget_build_url_ignore_dm with call behaviour switch between 1:1 and Widget (#12760)

* Align `widget_build_url_ignore_dm` with call behaviour switch between 1:1 and Widget

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve coverage

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-07-15 10:08:34 +01:00 committed by GitHub
parent 44454618d8
commit 3221f7cade
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 103 additions and 46 deletions

View file

@ -861,6 +861,12 @@ export default class LegacyCallHandler extends EventEmitter {
public async placeCall(roomId: string, type: CallType, transferee?: MatrixCall): Promise<void> {
const cli = MatrixClientPeg.safeGet();
const room = cli.getRoom(roomId);
if (!room) {
logger.error(`Room ${roomId} does not exist.`);
return;
}
// Pause current broadcast, if any
SdkContextClass.instance.voiceBroadcastPlaybacksStore.getCurrent()?.pause();
@ -871,8 +877,8 @@ export default class LegacyCallHandler extends EventEmitter {
}
// We might be using managed hybrid widgets
if (isManagedHybridWidgetEnabled(roomId)) {
await addManagedHybridWidget(roomId);
if (isManagedHybridWidgetEnabled(room)) {
await addManagedHybridWidget(room);
return;
}
@ -902,12 +908,6 @@ export default class LegacyCallHandler extends EventEmitter {
return;
}
const room = cli.getRoom(roomId);
if (!room) {
logger.error(`Room ${roomId} does not exist.`);
return;
}
// We leave the check for whether there's already a call in this room until later,
// otherwise it can race.