From ea7721fd652fd3cd223694ee7b86f914bd335774 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 25 May 2021 09:39:23 -0300 Subject: [PATCH] Fix "missing ThreadAssociatedData", again. --- .../RecipientPicker/ComposeViewController.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/RecipientPicker/ComposeViewController.swift b/Signal/src/ViewControllers/RecipientPicker/ComposeViewController.swift index 37d4176397..36c7eba722 100644 --- a/Signal/src/ViewControllers/RecipientPicker/ComposeViewController.swift +++ b/Signal/src/ViewControllers/RecipientPicker/ComposeViewController.swift @@ -51,8 +51,19 @@ class ComposeViewController: OWSViewController { func newConversation(address: SignalServiceAddress) { assert(address.isValid) - let thread = TSContactThread.getOrCreateThread(contactAddress: address) - newConversation(thread: thread) + + Self.databaseStorage.write { [weak self] transaction in + let thread = TSContactThread.getOrCreateThread(withContactAddress: address, + transaction: transaction) + Self.databaseStorage.touch(thread: thread, + shouldReindex: false, + transaction: transaction) + Self.databaseStorage.add(uiDatabaseSnapshotFlushBlock: { + DispatchQueue.main.async { + self?.newConversation(thread: thread) + } + }) + } } func newConversation(thread: TSThread) {