From a7d2309286fb07968320be9b2fd910382eb3be3b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 22 May 2019 16:34:11 -0600 Subject: [PATCH] Convert ternary to multiple if statements for clarity --- src/components/views/rooms/EventTile.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 130dff074c..3c7f3deec9 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -581,11 +581,14 @@ module.exports = withMatrixClient(React.createClass({ // Hopefully all of that leads to us not reading out messages in duplicate or triplicate. const sentByMyUserId = this.props.mxEvent.getSender() === MatrixClientPeg.get().getUserId(); const sentByThisDevice = !!this.props.mxEvent.getUnsigned()["transaction_id"]; - const screenReaderShouldSpeak = isSending ? false : ( - this.props.eventSendStatus - ? sentByMyUserId && this.props.eventSendStatus === 'sent' - : !sentByMyUserId || !sentByThisClient - ); + let screenReaderShouldSpeak = false; + if (!isSending) { + if (this.props.eventSendStatus === 'sent') { + screenReaderShouldSpeak = sentByMyUserId; + } else if (!this.props.eventSendStatus) { + screenReaderShouldSpeak = !sentByMyUserId || !sentByThisDevice; + } + } const classes = classNames({ mx_EventTile: true,