Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Don't allow group calls to be unterminated #9710

Merged
merged 2 commits into from
Dec 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/events/EventTileFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { shouldDisplayAsBeaconTile } from "../utils/beacon/timeline";
import { shouldDisplayAsVoiceBroadcastTile } from "../voice-broadcast/utils/shouldDisplayAsVoiceBroadcastTile";
import { ElementCall } from "../models/Call";
import { VoiceBroadcastChunkEventType } from "../voice-broadcast";
import { GroupCallIntent } from "matrix-js-sdk/src/webrtc/groupCall";

// Subset of EventTile's IProps plus some mixins
export interface EventTileTypeProps {
Expand Down Expand Up @@ -412,13 +413,9 @@ export function haveRendererForEvent(mxEvent: MatrixEvent, showHiddenEvents: boo
return Boolean(mxEvent.getContent()['predecessor']);
} else if (ElementCall.CALL_EVENT_TYPE.names.some(eventType => handler === STATE_EVENT_TILE_TYPES.get(eventType))) {
const intent = mxEvent.getContent()['m.intent'];
const prevContent = mxEvent.getPrevContent();
// If the call became unterminated or previously had invalid contents,
// then this event marks the start of the call
const newlyStarted = 'm.terminated' in prevContent
|| !('m.intent' in prevContent) || !('m.type' in prevContent);
const newlyStarted = Object.keys(mxEvent.getPrevContent()).length === 0
// Only interested in events that mark the start of a non-room call
return typeof intent === 'string' && intent !== 'm.room' && newlyStarted;
return newlyStarted && typeof intent === 'string' && intent !== GroupCallIntent.Room;
} else if (handler === JSONEventFactory) {
return false;
} else {
Expand Down