rename hasEverHadMessage -> shouldThreadBeVisible

pull/1/head
Michael Kirk 7 years ago
parent 4ac93276c6
commit c0cb7df10a

@ -806,7 +806,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([OWSProfileManager.sharedManager isThreadInProfileWhitelist:thread]) { if ([OWSProfileManager.sharedManager isThreadInProfileWhitelist:thread]) {
return NO; return NO;
} }
if (!thread.hasEverHadMessage) { if (!thread.shouldThreadBeVisible) {
[OWSProfileManager.sharedManager addThreadToProfileWhitelist:thread]; [OWSProfileManager.sharedManager addThreadToProfileWhitelist:thread];
return YES; return YES;
} else { } else {

@ -33,7 +33,7 @@ extern ConversationColorName const kConversationColorName_Default;
@interface TSThread : TSYapDatabaseObject @interface TSThread : TSYapDatabaseObject
// YES IFF this thread has ever had a message. // YES IFF this thread has ever had a message.
@property (nonatomic) BOOL hasEverHadMessage; @property (nonatomic) BOOL shouldThreadBeVisible;
/** /**
* Whether the object is a group thread or not. * Whether the object is a group thread or not.

@ -83,6 +83,15 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
return self; return self;
} }
// renamed `hasEverHadMessage` -> `shouldThreadBeVisible`
if (!_shouldThreadBeVisible) {
NSNumber *legacy_hasEverHadMessage = [coder decodeObjectForKey:@"hasEverHadMessage"];
if (legacy_hasEverHadMessage != nil) {
_shouldThreadBeVisible = legacy_hasEverHadMessage.boolValue;
}
}
if (_conversationColorName.length == 0) { if (_conversationColorName.length == 0) {
NSString *_Nullable colorSeed = self.contactIdentifier; NSString *_Nullable colorSeed = self.contactIdentifier;
if (colorSeed.length > 0) { if (colorSeed.length > 0) {
@ -390,7 +399,7 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
return; return;
} }
self.hasEverHadMessage = YES; self.shouldThreadBeVisible = YES;
NSDate *lastMessageDate = [lastMessage dateForSorting]; NSDate *lastMessageDate = [lastMessage dateForSorting];
if (!_lastMessageDate || [lastMessageDate timeIntervalSinceDate:self.lastMessageDate] > 0) { if (!_lastMessageDate || [lastMessageDate timeIntervalSinceDate:self.lastMessageDate] > 0) {

@ -204,7 +204,7 @@ public class FullTextSearchFinder: NSObject {
if let groupThread = object as? TSGroupThread { if let groupThread = object as? TSGroupThread {
return self.groupThreadIndexer.index(groupThread, transaction: transaction) return self.groupThreadIndexer.index(groupThread, transaction: transaction)
} else if let contactThread = object as? TSContactThread { } else if let contactThread = object as? TSContactThread {
guard contactThread.hasEverHadMessage else { guard contactThread.shouldThreadBeVisible else {
// If we've never sent/received a message in a TSContactThread, // If we've never sent/received a message in a TSContactThread,
// then we want it to appear in the "Other Contacts" section rather // then we want it to appear in the "Other Contacts" section rather
// than in the "Conversations" section. // than in the "Conversations" section.

@ -204,7 +204,7 @@ NSString *const TSLazyRestoreAttachmentsGroup = @"TSLazyRestoreAttachmentsGroup"
if (thread.isGroupThread) { if (thread.isGroupThread) {
// Do nothing; we never hide group threads. // Do nothing; we never hide group threads.
} else if (thread.hasEverHadMessage) { } else if (thread.shouldThreadBeVisible) {
// Do nothing; we never hide threads that have ever had a message. // Do nothing; we never hide threads that have ever had a message.
} else { } else {
YapDatabaseViewTransaction *viewTransaction = [transaction ext:TSMessageDatabaseViewExtensionName]; YapDatabaseViewTransaction *viewTransaction = [transaction ext:TSMessageDatabaseViewExtensionName];

Loading…
Cancel
Save