Groups: Update active_at more often when we detect group changes
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
2c9b8ff71d
commit
1c0c6c0604
1 changed files with 3 additions and 19 deletions
22
ts/groups.ts
22
ts/groups.ts
|
@ -3111,9 +3111,6 @@ async function updateGroup(
|
||||||
const ourAci = window.textsecure.storage.user.getCheckedAci();
|
const ourAci = window.textsecure.storage.user.getCheckedAci();
|
||||||
const ourPni = window.textsecure.storage.user.getPni();
|
const ourPni = window.textsecure.storage.user.getPni();
|
||||||
|
|
||||||
const startingRevision = conversation.get('revision');
|
|
||||||
const endingRevision = newAttributes.revision;
|
|
||||||
|
|
||||||
const wasMemberOrPending =
|
const wasMemberOrPending =
|
||||||
conversation.hasMember(ourAci) ||
|
conversation.hasMember(ourAci) ||
|
||||||
conversation.isMemberPending(ourAci) ||
|
conversation.isMemberPending(ourAci) ||
|
||||||
|
@ -3123,12 +3120,6 @@ async function updateGroup(
|
||||||
newAttributes.pendingMembersV2?.some(
|
newAttributes.pendingMembersV2?.some(
|
||||||
item => item.serviceId === ourAci || item.serviceId === ourPni
|
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.
|
// Ensure that all generated messages are ordered properly.
|
||||||
// Before the provided timestamp so update messages appear before the
|
// Before the provided timestamp so update messages appear before the
|
||||||
|
@ -3141,17 +3132,10 @@ async function updateGroup(
|
||||||
const previousId = conversation.get('groupId');
|
const previousId = conversation.get('groupId');
|
||||||
const idChanged = previousId && previousId !== newAttributes.groupId;
|
const idChanged = previousId && previousId !== newAttributes.groupId;
|
||||||
|
|
||||||
// By updating activeAt we force this conversation into the left pane if this is the
|
// By updating activeAt we force this conversation into the left panel. We don't want
|
||||||
// first time we've fetched data about it, and we were able to fetch its name. Nobody
|
// all groups to show up on link, and we don't want Unknown Group in the left pane.
|
||||||
// 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.
|
|
||||||
let activeAt = conversation.get('active_at') || null;
|
let activeAt = conversation.get('active_at') || null;
|
||||||
if (
|
if (!viaFirstStorageSync && newAttributes.name) {
|
||||||
!viaFirstStorageSync &&
|
|
||||||
isMemberOrPendingOrAwaitingApproval &&
|
|
||||||
isInitialDataFetch &&
|
|
||||||
newAttributes.name
|
|
||||||
) {
|
|
||||||
activeAt = initialSentAt;
|
activeAt = initialSentAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue