Convert ternary to multiple if statements for clarity

pull/21833/head
Travis Ralston 2019-05-22 16:34:11 -06:00
parent d571709fe8
commit a7d2309286
1 changed files with 8 additions and 5 deletions

View File

@ -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,