Fix check for successfull delivery

This commit is contained in:
Fedor Indutny 2021-06-23 10:01:13 -07:00 committed by GitHub
parent c1e2757751
commit d623533707
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View file

@ -3271,7 +3271,7 @@ export class ConversationModel extends window.Backbone
'Error sending deleteForEveryone', 'Error sending deleteForEveryone',
deleteModel, deleteModel,
targetTimestamp, targetTimestamp,
error error && error.stack
); );
throw error; throw error;

View file

@ -1366,6 +1366,11 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
} }
public hasSuccessfulDelivery(): boolean { public hasSuccessfulDelivery(): boolean {
const recipients = this.get('recipients') || [];
if (recipients.length === 0) {
return true;
}
return (this.get('sent_to') || []).length !== 0; return (this.get('sent_to') || []).length !== 0;
} }

View file

@ -2939,7 +2939,7 @@ Whisper.ConversationView = Whisper.View.extend({
} catch (error) { } catch (error) {
window.log.error( window.log.error(
'Error sending delete-for-everyone', 'Error sending delete-for-everyone',
error, error && error.stack,
messageId messageId
); );
this.showToast(Whisper.DeleteForEveryoneFailedToast); this.showToast(Whisper.DeleteForEveryoneFailedToast);