Don't send messages with restoring attachments.

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

@ -184,7 +184,11 @@ void AssertIsOnSendingQueue()
if (self.message.hasAttachments) { if (self.message.hasAttachments) {
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { [self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
for (TSAttachment *attachment in [self.message attachmentsWithTransaction: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; TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment;
OWSAssertDebug(attachmentStream); OWSAssertDebug(attachmentStream);
OWSAssertDebug(attachmentStream.serverId); OWSAssertDebug(attachmentStream.serverId);

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

Loading…
Cancel
Save