From f7b66f05a0e562d97cf0642e52f3d87c322943f1 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Wed, 11 Sep 2019 16:25:33 +1000 Subject: [PATCH] Fix group chat quote display name --- .../ConversationView/Cells/OWSQuotedMessageView.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index aebc4db13..92cdf5ec1 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -549,7 +549,16 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3; } } else { OWSContactsManager *contactsManager = Environment.shared.contactsManager; - NSString *quotedAuthor = [contactsManager contactOrProfileNameForPhoneIdentifier:self.quotedMessage.authorId]; + __block NSString *quotedAuthor = [contactsManager contactOrProfileNameForPhoneIdentifier:self.quotedMessage.authorId]; + + if (quotedAuthor == self.quotedMessage.authorId) { + [OWSPrimaryStorage.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { + NSString *collection = [NSString stringWithFormat:@"%@.%@", LKGroupChatAPI.publicChatServer, @(LKGroupChatAPI.publicChatServerID)]; + NSString *displayName = [transaction stringForKey:self.quotedMessage.authorId inCollection:collection]; + if (displayName != nil) { quotedAuthor = displayName; } + }]; + } + quotedAuthorText = [NSString stringWithFormat: NSLocalizedString(@"QUOTED_REPLY_AUTHOR_INDICATOR_FORMAT",