From 46e47a821e8b965f3fb0196722f1ea62d4ba3013 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Sat, 17 Dec 2022 23:22:31 +0000 Subject: [PATCH] Clean up signature of `verifyEvent` It doesn't need to be `async`, and it doesn't need us to pass in the event every time. --- src/components/views/rooms/EventTile.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/views/rooms/EventTile.tsx b/src/components/views/rooms/EventTile.tsx index e34bf8716f..8fe1aa15ba 100644 --- a/src/components/views/rooms/EventTile.tsx +++ b/src/components/views/rooms/EventTile.tsx @@ -395,7 +395,7 @@ export class UnwrappedEventTile extends React.Component const room = client.getRoom(this.props.mxEvent.getRoomId()); room?.on(ThreadEvent.New, this.onNewThread); - this.verifyEvent(this.props.mxEvent); + this.verifyEvent(); } private get supportsThreadNotifications(): boolean { @@ -478,7 +478,7 @@ export class UnwrappedEventTile extends React.Component } // re-check the sender verification as outgoing events progress through the send process. if (prevProps.eventSendStatus !== this.props.eventSendStatus) { - this.verifyEvent(this.props.mxEvent); + this.verifyEvent(); } } @@ -588,23 +588,25 @@ export class UnwrappedEventTile extends React.Component // we need to re-verify the sending device. // (we call onHeightChanged in verifyEvent to handle the case where decryption // has caused a change in size of the event tile) - this.verifyEvent(this.props.mxEvent); + this.verifyEvent(); this.forceUpdate(); }; private onDeviceVerificationChanged = (userId: string, device: string): void => { if (userId === this.props.mxEvent.getSender()) { - this.verifyEvent(this.props.mxEvent); + this.verifyEvent(); } }; private onUserVerificationChanged = (userId: string, _trustStatus: UserTrustLevel): void => { if (userId === this.props.mxEvent.getSender()) { - this.verifyEvent(this.props.mxEvent); + this.verifyEvent(); } }; - private async verifyEvent(mxEvent: MatrixEvent): Promise { + private verifyEvent(): void { + const mxEvent = this.props.mxEvent; + if (!mxEvent.isEncrypted() || mxEvent.isRedacted()) { return; }