Prevent replies/reactions on messages with errors

This commit is contained in:
Ken Powers 2020-02-07 18:13:46 -05:00 committed by GitHub
parent f37e73c723
commit 101070bf42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 31 deletions

View file

@ -534,6 +534,7 @@
timestamp: this.get('sent_at'),
status: this.getMessagePropStatus(),
contact: this.getPropsForEmbeddedContact(),
canReply: this.canReply(),
authorColor,
authorName: contact.name,
authorProfileName: contact.profileName,
@ -1305,6 +1306,24 @@
e.name === 'OutgoingIdentityKeyError'
);
},
canReply() {
const errors = this.get('errors');
const isOutgoing = this.get('type') === 'outgoing';
const numDelivered = this.get('delivered');
// Case 1: We can reply if this is outgoing and delievered to at least one recipient
if (isOutgoing && numDelivered > 0) {
return true;
}
// Case 2: We can reply if there are no errors
if (errors && errors.length === 0) {
return true;
}
// Otherwise we cannot reply
return false;
},
// Called when the user ran into an error with a specific user, wants to send to them
// One caller today: ConversationView.forceSend()