From a95b92d0ee0e1abe71ff825e036c88cf13ad90f7 Mon Sep 17 00:00:00 2001 From: Joshua Blum Date: Wed, 28 Aug 2019 16:47:15 -0400 Subject: [PATCH] GetUnverifiedConv in each thread --- go/chat/uithreadloader.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/go/chat/uithreadloader.go b/go/chat/uithreadloader.go index ec863a38b0f6..b8b7677b34dd 100644 --- a/go/chat/uithreadloader.go +++ b/go/chat/uithreadloader.go @@ -440,10 +440,6 @@ func (t *UIThreadLoader) LoadNonblock(ctx context.Context, chatUI libkb.ChatUI, if pagination != nil && pagination.Last { return nil } - conv, ierr := utils.GetUnverifiedConv(ctx, t.G(), uid, convID, types.InboxSourceDataSourceAll) - if ierr != nil { - return ierr - } // Race the full operation versus the local one, so we don't lose anytime grabbing the local // version if they are roughly as fast. However, the full operation has preference, so if it does @@ -512,6 +508,11 @@ func (t *UIThreadLoader) LoadNonblock(ctx context.Context, chatUI libkb.ChatUI, } var pthread *string if resThread != nil { + conv, err := utils.GetUnverifiedConv(ctx, t.G(), uid, convID, types.InboxSourceDataSourceLocalOnly) + if err != nil { + t.Debug(ctx, "LoadNonblock: failed to GetUnverifiedConv localonly: %v", err) + return + } *resThread = t.groupThreadView(ctx, uid, *resThread, conv) t.Debug(ctx, "LoadNonblock: sending cached response: messages: %d pager: %s", len(resThread.Messages), resThread.Pagination) @@ -540,6 +541,7 @@ func (t *UIThreadLoader) LoadNonblock(ctx context.Context, chatUI libkb.ChatUI, getDelay := func() time.Duration { return baseDelay - (t.clock.Now().Sub(startTime)) } + var rconv types.RemoteConversation wg.Add(1) go func() { defer wg.Done() @@ -561,7 +563,11 @@ func (t *UIThreadLoader) LoadNonblock(ctx context.Context, chatUI libkb.ChatUI, uilock.Lock() defer uilock.Unlock() var rthread chat1.ThreadView - remoteThread = t.groupThreadView(ctx, uid, remoteThread, conv) + rconv, fullErr = utils.GetUnverifiedConv(ctx, t.G(), uid, convID, types.InboxSourceDataSourceAll) + if fullErr != nil { + return + } + remoteThread = t.groupThreadView(ctx, uid, remoteThread, rconv) if rthread, fullErr = t.mergeLocalRemoteThread(ctx, &remoteThread, localSentThread, cbmode); fullErr != nil { return @@ -630,7 +636,8 @@ func (t *UIThreadLoader) LoadNonblock(ctx context.Context, chatUI libkb.ChatUI, if len(changed) == 0 { continue } - if changed, ierr = t.G().ConvSource.TransformSupersedes(ctx, conv.Conv, uid, changed, + var ierr error + if changed, ierr = t.G().ConvSource.TransformSupersedes(ctx, rconv.Conv, uid, changed, query, nil, nil); ierr != nil { return ierr }