Ensure quoted replies with attachments are handled properly.

This commit is contained in:
Matthew Chen 2018-11-30 10:59:11 -05:00 committed by Michael Kirk
parent 68b939d89d
commit ab9e2c4e11
1 changed files with 12 additions and 10 deletions

View File

@ -561,6 +561,18 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return;
}
// Check for quoted replies _before_ media album handling,
// since that logic may exit early.
if (message.quotedMessage) {
self.quotedReply =
[OWSQuotedReplyModel quotedReplyWithQuotedMessage:message.quotedMessage transaction:transaction];
if (self.quotedReply.body.length > 0) {
self.displayableQuotedText =
[self displayableQuotedTextForText:self.quotedReply.body interactionId:message.uniqueId];
}
}
NSArray<TSAttachment *> *attachments = [message attachmentsWithTransaction:transaction];
if ([message isMediaAlbumWithTransaction:transaction]) {
OWSAssertDebug(attachments.count > 0);
@ -642,16 +654,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
self.messageCellType = OWSMessageCellType_TextMessage;
self.displayableBodyText = [[DisplayableText alloc] initWithFullText:@"" displayText:@"" isTextTruncated:NO];
}
if (message.quotedMessage) {
self.quotedReply =
[OWSQuotedReplyModel quotedReplyWithQuotedMessage:message.quotedMessage transaction:transaction];
if (self.quotedReply.body.length > 0) {
self.displayableQuotedText =
[self displayableQuotedTextForText:self.quotedReply.body interactionId:message.uniqueId];
}
}
}
- (NSArray<ConversationMediaAlbumItem *> *)mediaAlbumItemsForAttachments:(NSArray<TSAttachment *> *)attachments