From 1c0c6c0604e43942c02c37bd845c59c9347e69db Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Mon, 27 May 2024 20:29:25 -0500 Subject: [PATCH] Groups: Update active_at more often when we detect group changes Co-authored-by: Scott Nonnenberg --- ts/groups.ts | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/ts/groups.ts b/ts/groups.ts index 1154e3953a..edb524143e 100644 --- a/ts/groups.ts +++ b/ts/groups.ts @@ -3111,9 +3111,6 @@ async function updateGroup( const ourAci = window.textsecure.storage.user.getCheckedAci(); const ourPni = window.textsecure.storage.user.getPni(); - const startingRevision = conversation.get('revision'); - const endingRevision = newAttributes.revision; - const wasMemberOrPending = conversation.hasMember(ourAci) || conversation.isMemberPending(ourAci) || @@ -3123,12 +3120,6 @@ async function updateGroup( newAttributes.pendingMembersV2?.some( item => item.serviceId === ourAci || item.serviceId === ourPni ); - const isMemberOrPendingOrAwaitingApproval = - isMemberOrPending || - newAttributes.pendingAdminApprovalV2?.some(item => item.aci === ourAci); - - const isInitialDataFetch = - !isNumber(startingRevision) && isNumber(endingRevision); // Ensure that all generated messages are ordered properly. // Before the provided timestamp so update messages appear before the @@ -3141,17 +3132,10 @@ async function updateGroup( const previousId = conversation.get('groupId'); const idChanged = previousId && previousId !== newAttributes.groupId; - // By updating activeAt we force this conversation into the left pane if this is the - // first time we've fetched data about it, and we were able to fetch its name. Nobody - // likes to see Unknown Group in the left pane. After first fetch, we rely on normal - // message activity (including group change messages) to set the timestamp properly. + // By updating activeAt we force this conversation into the left panel. We don't want + // all groups to show up on link, and we don't want Unknown Group in the left pane. let activeAt = conversation.get('active_at') || null; - if ( - !viaFirstStorageSync && - isMemberOrPendingOrAwaitingApproval && - isInitialDataFetch && - newAttributes.name - ) { + if (!viaFirstStorageSync && newAttributes.name) { activeAt = initialSentAt; }