From 19bc3f1d9aaaace7df7c13772511b1453f612a6c Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Wed, 12 Oct 2022 13:24:30 +0200 Subject: [PATCH] Include device_id in voice broadcast info events (#9394) --- src/voice-broadcast/index.ts | 1 + src/voice-broadcast/models/VoiceBroadcastRecording.ts | 1 + src/voice-broadcast/utils/startNewVoiceBroadcastRecording.ts | 1 + test/voice-broadcast/models/VoiceBroadcastRecording-test.ts | 4 ++++ .../utils/startNewVoiceBroadcastRecording-test.ts | 1 + 5 files changed, 8 insertions(+) diff --git a/src/voice-broadcast/index.ts b/src/voice-broadcast/index.ts index 2f69b84918..2765cf4f25 100644 --- a/src/voice-broadcast/index.ts +++ b/src/voice-broadcast/index.ts @@ -40,6 +40,7 @@ export enum VoiceBroadcastInfoState { } export interface VoiceBroadcastInfoEventContent { + device_id: string; state: VoiceBroadcastInfoState; chunk_length?: number; ["m.relates_to"]?: { diff --git a/src/voice-broadcast/models/VoiceBroadcastRecording.ts b/src/voice-broadcast/models/VoiceBroadcastRecording.ts index 97351b2e1b..bea71cc274 100644 --- a/src/voice-broadcast/models/VoiceBroadcastRecording.ts +++ b/src/voice-broadcast/models/VoiceBroadcastRecording.ts @@ -146,6 +146,7 @@ export class VoiceBroadcastRecording this.infoEvent.getRoomId(), VoiceBroadcastInfoEventType, { + device_id: this.client.getDeviceId(), state: VoiceBroadcastInfoState.Stopped, ["m.relates_to"]: { rel_type: RelationType.Reference, diff --git a/src/voice-broadcast/utils/startNewVoiceBroadcastRecording.ts b/src/voice-broadcast/utils/startNewVoiceBroadcastRecording.ts index be88963e8c..272958e5d0 100644 --- a/src/voice-broadcast/utils/startNewVoiceBroadcastRecording.ts +++ b/src/voice-broadcast/utils/startNewVoiceBroadcastRecording.ts @@ -65,6 +65,7 @@ export const startNewVoiceBroadcastRecording = async ( roomId, VoiceBroadcastInfoEventType, { + device_id: client.getDeviceId(), state: VoiceBroadcastInfoState.Started, chunk_length: 300, } as VoiceBroadcastInfoEventContent, diff --git a/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts b/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts index 357180c700..5fca34e035 100644 --- a/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts +++ b/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts @@ -160,6 +160,7 @@ describe("VoiceBroadcastRecording", () => { describe("when created for a Voice Broadcast Info without relations", () => { beforeEach(() => { infoEvent = mkVoiceBroadcastInfoEvent({ + device_id: client.getDeviceId(), state: VoiceBroadcastInfoState.Started, }); setUpVoiceBroadcastRecording(); @@ -179,6 +180,7 @@ describe("VoiceBroadcastRecording", () => { roomId, VoiceBroadcastInfoEventType, { + device_id: client.getDeviceId(), state: VoiceBroadcastInfoState.Stopped, ["m.relates_to"]: { rel_type: RelationType.Reference, @@ -344,6 +346,7 @@ describe("VoiceBroadcastRecording", () => { describe("when created for a Voice Broadcast Info with a Stopped relation", () => { beforeEach(() => { infoEvent = mkVoiceBroadcastInfoEvent({ + device_id: client.getDeviceId(), state: VoiceBroadcastInfoState.Started, chunk_length: 300, }); @@ -353,6 +356,7 @@ describe("VoiceBroadcastRecording", () => { } as unknown as Relations; mocked(relationsContainer.getRelations).mockReturnValue([ mkVoiceBroadcastInfoEvent({ + device_id: client.getDeviceId(), state: VoiceBroadcastInfoState.Stopped, ["m.relates_to"]: { rel_type: RelationType.Reference, diff --git a/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts b/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts index 0096817b3f..570719539a 100644 --- a/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts +++ b/test/voice-broadcast/utils/startNewVoiceBroadcastRecording-test.ts @@ -89,6 +89,7 @@ describe("startNewVoiceBroadcastRecording", () => { event: true, type: VoiceBroadcastInfoEventType, content: { + device_id: client.getDeviceId(), state: VoiceBroadcastInfoState.Started, }, user: client.getUserId(),