mirror of https://github.com/vector-im/riot-web
Let Element Call widget set session memberships (#12713)
* Let Element Call widget set session memberships Grant Element Call widgets permission to set device-specific session membership state events. * Lint * Test that call widgets can set session membership * Add comments for each membership typepull/28217/head
parent
f7a078d250
commit
c843a4163a
|
@ -144,13 +144,31 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
|||
this.allowedCapabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomEncryption).raw,
|
||||
);
|
||||
const clientUserId = MatrixClientPeg.safeGet().getSafeUserId();
|
||||
// For the legacy membership type
|
||||
this.allowedCapabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Send, "org.matrix.msc3401.call.member", clientUserId)
|
||||
.raw,
|
||||
);
|
||||
const clientDeviceId = MatrixClientPeg.safeGet().getDeviceId();
|
||||
if (clientDeviceId !== null) {
|
||||
// For the session membership type compliant with MSC4143
|
||||
this.allowedCapabilities.add(
|
||||
WidgetEventCapability.forStateEvent(
|
||||
EventDirection.Send,
|
||||
"org.matrix.msc3401.call.member",
|
||||
MatrixClientPeg.safeGet().getSafeUserId(),
|
||||
`_${clientUserId}_${clientDeviceId}`,
|
||||
).raw,
|
||||
);
|
||||
// MSC3779 version, with no leading underscore
|
||||
this.allowedCapabilities.add(
|
||||
WidgetEventCapability.forStateEvent(
|
||||
EventDirection.Send,
|
||||
"org.matrix.msc3401.call.member",
|
||||
`${clientUserId}_${clientDeviceId}`,
|
||||
).raw,
|
||||
);
|
||||
}
|
||||
this.allowedCapabilities.add(
|
||||
WidgetEventCapability.forStateEvent(EventDirection.Receive, "org.matrix.msc3401.call.member").raw,
|
||||
);
|
||||
|
|
|
@ -99,6 +99,8 @@ describe("StopGapWidgetDriver", () => {
|
|||
"org.matrix.msc2762.receive.state_event:org.matrix.msc3401.call",
|
||||
"org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@alice:example.org",
|
||||
"org.matrix.msc2762.receive.state_event:org.matrix.msc3401.call.member",
|
||||
`org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#_@alice:example.org_${client.deviceId}`,
|
||||
`org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@alice:example.org_${client.deviceId}`,
|
||||
"org.matrix.msc3819.send.to_device:m.call.invite",
|
||||
"org.matrix.msc3819.receive.to_device:m.call.invite",
|
||||
"org.matrix.msc3819.send.to_device:m.call.candidates",
|
||||
|
|
Loading…
Reference in New Issue