Merge branch 'mkirk/fix-unregistered-display-name'

This commit is contained in:
Michael Kirk 2017-05-18 11:57:33 -04:00
commit 4a33662515

View file

@ -250,10 +250,11 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification =
return self.unknownContactName;
}
// TODO: There's some overlap here with displayNameForSignalAccount.
SignalAccount *signalAccount = [self signalAccountForRecipientId:identifier];
// When viewing an old thread with someone who is no longer a Signal user, they won't have a SignalAccount
// so we get the name from `allContactsMap` as opposed to `signalAccountForRecipientId`.
Contact *contact = self.allContactsMap[identifier];
NSString *displayName = (signalAccount.contact.fullName.length > 0) ? signalAccount.contact.fullName : identifier;
NSString *displayName = (contact.fullName.length > 0) ? contact.fullName : identifier;
return displayName;
}