Don't send messages with restoring attachments.

pull/1/head
Matthew Chen 6 years ago
parent 15dc7b2c7c
commit ca65325710

@ -184,7 +184,11 @@ void AssertIsOnSendingQueue()
if (self.message.hasAttachments) {
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
for (TSAttachment *attachment in [self.message attachmentsWithTransaction:transaction]) {
OWSAssertDebug([attachment isKindOfClass:[TSAttachmentStream class]]);
if (![attachment isKindOfClass:[TSAttachmentStream class]]) {
return OWSErrorWithCodeDescription(
OWSErrorCodeMessageHasInvalidAttachments, @"Message with missing attachments cannot be sent.");
}
TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment;
OWSAssertDebug(attachmentStream);
OWSAssertDebug(attachmentStream.serverId);

@ -51,6 +51,7 @@ typedef NS_ENUM(NSInteger, OWSErrorCode) {
OWSErrorCodeProfileUpdateFailed = 777424,
OWSErrorCodeAvatarWriteFailed = 777425,
OWSErrorCodeAvatarUploadFailed = 777426,
OWSErrorCodeMessageHasInvalidAttachments,
};
extern NSString *const OWSErrorRecipientIdentifierKey;

Loading…
Cancel
Save