Merge remote-tracking branch 'private/mkirk/soft-delete' into release/2.42.4
This commit is contained in:
commit
a46ea14756
@ -5262,12 +5262,10 @@ typedef enum : NSUInteger {
|
||||
[self.messageSenderJobQueue addMessage:message transaction:transaction];
|
||||
[groupThread leaveGroupWithTransaction:transaction];
|
||||
}
|
||||
|
||||
[groupThread softDeleteGroupThreadWithTransaction:transaction];
|
||||
} else {
|
||||
[self.thread anyRemoveWithTransaction:transaction];
|
||||
}
|
||||
|
||||
[self.thread softDeleteThreadWithTransaction:transaction];
|
||||
|
||||
[transaction addCompletionWithBlock:^{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
|
||||
@ -1378,12 +1378,14 @@ NSString *const kArchiveButtonPseudoGroup = @"kArchiveButtonPseudoGroup";
|
||||
if ([thread isKindOfClass:[TSGroupThread class]]) {
|
||||
TSGroupThread *groupThread = (TSGroupThread *)thread;
|
||||
if (groupThread.isLocalUserInGroup) {
|
||||
[groupThread softDeleteGroupThreadWithTransaction:transaction];
|
||||
return;
|
||||
[groupThread softDeleteThreadWithTransaction:transaction];
|
||||
} else {
|
||||
[groupThread anyRemoveWithTransaction:transaction];
|
||||
}
|
||||
} else {
|
||||
// contact thread
|
||||
[thread softDeleteThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
[thread anyRemoveWithTransaction:transaction];
|
||||
}];
|
||||
|
||||
[self updateViewState];
|
||||
|
||||
@ -290,12 +290,17 @@ public class FullTextSearcher: NSObject {
|
||||
let sortKey = ConversationSortKey(creationDate: thread.creationDate,
|
||||
lastMessageReceivedAtDate: thread.lastInteractionForInbox(transaction: transaction)?.receivedAtDate())
|
||||
let searchResult = ConversationSearchResult(thread: threadViewModel, sortKey: sortKey)
|
||||
|
||||
if let contactThread = thread as? TSContactThread {
|
||||
existingConversationAddresses.insert(contactThread.contactAddress)
|
||||
switch thread {
|
||||
case is TSGroupThread:
|
||||
conversations.append(searchResult)
|
||||
case let contactThread as TSContactThread:
|
||||
if contactThread.shouldThreadBeVisible {
|
||||
existingConversationAddresses.insert(contactThread.contactAddress)
|
||||
conversations.append(searchResult)
|
||||
}
|
||||
default:
|
||||
owsFailDebug("unexpected thread: \(type(of: thread))")
|
||||
}
|
||||
|
||||
conversations.append(searchResult)
|
||||
} else if let message = match as? TSMessage {
|
||||
let thread = message.thread(transaction: transaction)
|
||||
|
||||
|
||||
@ -138,6 +138,8 @@ NS_SWIFT_NAME(init(uniqueId:archivalDate:archivedAsOfMessageSortId:conversationC
|
||||
*/
|
||||
- (void)archiveThreadWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
||||
|
||||
- (void)softDeleteThreadWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
||||
|
||||
/**
|
||||
* Unarchives a thread
|
||||
*
|
||||
|
||||
@ -447,6 +447,16 @@ isArchivedByLegacyTimestampForSorting:(BOOL)isArchivedByLegacyTimestampForSortin
|
||||
}
|
||||
}
|
||||
|
||||
- (void)softDeleteThreadWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
{
|
||||
[self removeAllThreadInteractionsWithTransaction:transaction];
|
||||
[self anyUpdateWithTransaction:transaction
|
||||
block:^(TSThread *thread) {
|
||||
thread.messageDraft = nil;
|
||||
thread.shouldThreadBeVisible = NO;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Disappearing Messages
|
||||
|
||||
- (OWSDisappearingMessagesConfiguration *)disappearingMessagesConfigurationWithTransaction:
|
||||
|
||||
@ -69,8 +69,6 @@ NS_SWIFT_NAME(init(uniqueId:archivalDate:archivedAsOfMessageSortId:conversationC
|
||||
- (void)leaveGroupWithSneakyTransaction;
|
||||
- (void)leaveGroupWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
||||
|
||||
- (void)softDeleteGroupThreadWithTransaction:(SDSAnyWriteTransaction *)transaction;
|
||||
|
||||
#pragma mark - Avatar
|
||||
|
||||
- (void)updateAvatarWithAttachmentStream:(TSAttachmentStream *)attachmentStream;
|
||||
|
||||
@ -260,16 +260,6 @@ isArchivedByLegacyTimestampForSorting:isArchivedByLegacyTimestampForSorting
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)softDeleteGroupThreadWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
{
|
||||
[self removeAllThreadInteractionsWithTransaction:transaction];
|
||||
|
||||
[self anyUpdateGroupThreadWithTransaction:transaction
|
||||
block:^(TSGroupThread *thread) {
|
||||
thread.shouldThreadBeVisible = NO;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Avatar
|
||||
|
||||
- (void)updateAvatarWithAttachmentStream:(TSAttachmentStream *)attachmentStream
|
||||
|
||||
Loading…
Reference in New Issue
Block a user