Don't show replaced calls in the timeline (#7452)

* Don't show replaced calls in the timeline

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Revert changes to CallEvent

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Add option to force hide event

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Hide replaced calls

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2022-01-31 17:09:34 +01:00 committed by GitHub
parent 991257cbc3
commit a55482b0ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View file

@ -24,6 +24,7 @@ import { RoomMember } from "matrix-js-sdk/src/models/room-member";
import { Thread, ThreadEvent } from 'matrix-js-sdk/src/models/thread';
import { logger } from "matrix-js-sdk/src/logger";
import { NotificationCountType, Room } from 'matrix-js-sdk/src/models/room';
import { CallErrorCode } from "matrix-js-sdk/src/webrtc/call";
import { M_POLL_START } from "matrix-events-sdk";
import ReplyChain from "../elements/ReplyChain";
@ -1097,10 +1098,21 @@ export default class EventTile extends React.Component<IProps, IState> {
});
};
/**
* In some cases we can't use shouldHideEvent() since whether or not we hide
* an event depends on other things that the event itself
* @returns {boolean} true if event should be hidden
*/
private shouldHideEvent(): boolean {
// If the call was replaced we don't render anything since we render the other call
if (this.props.callEventGrouper?.hangupReason === CallErrorCode.Replaced) return true;
return false;
}
render() {
const msgtype = this.props.mxEvent.getContent().msgtype;
const eventType = this.props.mxEvent.getType() as EventType;
const eventDisplayInfo = getEventDisplayInfo(this.props.mxEvent);
const {
tileHandler,
isBubbleMessage,
@ -1108,7 +1120,7 @@ export default class EventTile extends React.Component<IProps, IState> {
isLeftAlignedBubbleMessage,
noBubbleEvent,
isSeeingThroughMessageHiddenForModeration,
} = eventDisplayInfo;
} = getEventDisplayInfo(this.props.mxEvent, this.shouldHideEvent());
const { isQuoteExpanded } = this.state;
// This shouldn't happen: the caller should check we support this type