diff --git a/SignalMessaging/Views/ContactCellView.m b/SignalMessaging/Views/ContactCellView.m index 5d744681bb..4421d76883 100644 --- a/SignalMessaging/Views/ContactCellView.m +++ b/SignalMessaging/Views/ContactCellView.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // #import "ContactCellView.h" @@ -140,7 +140,7 @@ const CGFloat kContactCellAvatarTextMargin = 12; self.thread = [TSContactThread getThreadWithContactId:recipientId transaction:transaction]; }]; - BOOL isNoteToSelf = [recipientId isEqualToString:self.tsAccountManager.localNumber]; + BOOL isNoteToSelf = (IsNoteToSelfEnabled() && [recipientId isEqualToString:self.tsAccountManager.localNumber]); if (isNoteToSelf) { self.nameLabel.attributedText = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.") diff --git a/SignalMessaging/utils/ConversationSearcher.swift b/SignalMessaging/utils/ConversationSearcher.swift index 315d5b5e61..f17a11f8aa 100644 --- a/SignalMessaging/utils/ConversationSearcher.swift +++ b/SignalMessaging/utils/ConversationSearcher.swift @@ -241,11 +241,11 @@ public class ConversationSearcher: NSObject { private func conversationIndexingString(recipientId: String) -> String { var result = self.indexingString(recipientId: recipientId) - if let localNumber = tsAccountManager.localNumber() { - if localNumber == recipientId { - let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.") - result += " \(noteToSelfLabel)" - } + if IsNoteToSelfEnabled(), + let localNumber = tsAccountManager.localNumber(), + localNumber == recipientId { + let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.") + result += " \(noteToSelfLabel)" } return result diff --git a/SignalServiceKit/src/Contacts/TSThread.h b/SignalServiceKit/src/Contacts/TSThread.h index 2aa098655e..fa4527b12b 100644 --- a/SignalServiceKit/src/Contacts/TSThread.h +++ b/SignalServiceKit/src/Contacts/TSThread.h @@ -6,6 +6,8 @@ NS_ASSUME_NONNULL_BEGIN +BOOL IsNoteToSelfEnabled(void); + @class OWSDisappearingMessagesConfiguration; @class TSInteraction; @class TSInvalidIdentityKeyReceivingErrorMessage; diff --git a/SignalServiceKit/src/Contacts/TSThread.m b/SignalServiceKit/src/Contacts/TSThread.m index 26eb0b6979..97e95158df 100644 --- a/SignalServiceKit/src/Contacts/TSThread.m +++ b/SignalServiceKit/src/Contacts/TSThread.m @@ -22,6 +22,11 @@ NS_ASSUME_NONNULL_BEGIN +BOOL IsNoteToSelfEnabled(void) +{ + return NO; +} + ConversationColorName const ConversationColorNameCrimson = @"red"; ConversationColorName const ConversationColorNameVermilion = @"orange"; ConversationColorName const ConversationColorNameBurlap = @"brown"; @@ -194,6 +199,9 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa - (BOOL)isNoteToSelf { + if (!IsNoteToSelfEnabled()) { + return NO; + } return (!self.isGroupThread && self.contactIdentifier != nil && [self.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]); } diff --git a/SignalServiceKit/src/Storage/FullTextSearchFinder.swift b/SignalServiceKit/src/Storage/FullTextSearchFinder.swift index ed4c7cdccd..00b64dd119 100644 --- a/SignalServiceKit/src/Storage/FullTextSearchFinder.swift +++ b/SignalServiceKit/src/Storage/FullTextSearchFinder.swift @@ -171,11 +171,12 @@ public class FullTextSearchFinder: NSObject { let recipientId = contactThread.contactIdentifier() var result = recipientIndexer.index(recipientId, transaction: transaction) - if let localNumber = tsAccountManager.storedOrCachedLocalNumber(transaction) { - if localNumber == recipientId { - let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.") - result += " \(noteToSelfLabel)" - } + if IsNoteToSelfEnabled(), + let localNumber = tsAccountManager.storedOrCachedLocalNumber(transaction), + localNumber == recipientId { + + let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.") + result += " \(noteToSelfLabel)" } return result