From ab9e2c4e1188be60ebfe24f94dd47e890c0bc42b Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 30 Nov 2018 10:59:11 -0500 Subject: [PATCH] Ensure quoted replies with attachments are handled properly. --- .../ConversationView/ConversationViewItem.m | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index b5f4c3863..7a2c75cfd 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -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 *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 *)mediaAlbumItemsForAttachments:(NSArray *)attachments