Skip to content

Commit 495b6dc

Browse files
authored
Merge pull request matrix-org#6705 from SimonBrandner/fix/call-tile-dispatch/18825
Use disptacher to answer/reject calls in call tiles
2 parents 94cef3b + 367049b commit 495b6dc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/components/structures/CallEventGrouper.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@ export default class CallEventGrouper extends EventEmitter {
105105
return ![...this.events].some((event) => event.sender?.userId === MatrixClientPeg.get().getUserId());
106106
}
107107

108-
private get callId(): string {
109-
return [...this.events][0].getContent().call_id;
108+
private get callId(): string | undefined {
109+
return [...this.events][0]?.getContent()?.call_id;
110+
}
111+
112+
private get roomId(): string | undefined {
113+
return [...this.events][0]?.getRoomId();
110114
}
111115

112116
private onSilencedCallsChanged = () => {
@@ -119,18 +123,24 @@ export default class CallEventGrouper extends EventEmitter {
119123
};
120124

121125
public answerCall = () => {
122-
this.call?.answer();
126+
defaultDispatcher.dispatch({
127+
action: 'answer',
128+
room_id: this.roomId,
129+
});
123130
};
124131

125132
public rejectCall = () => {
126-
this.call?.reject();
133+
defaultDispatcher.dispatch({
134+
action: 'reject',
135+
room_id: this.roomId,
136+
});
127137
};
128138

129139
public callBack = () => {
130140
defaultDispatcher.dispatch({
131141
action: 'place_call',
132142
type: this.isVoice ? CallType.Voice : CallType.Video,
133-
room_id: [...this.events][0]?.getRoomId(),
143+
room_id: this.roomId,
134144
});
135145
};
136146

0 commit comments

Comments
 (0)