@ -203,7 +203,7 @@ export async function handleNewClosedGroup(
// Enable typing:
maybeConvo . set ( 'isKickedFromGroup' , false ) ;
maybeConvo . set ( 'left' , false ) ;
maybeConvo . set ( 'lastJoinedTimestamp' , Date . now ( ) ) ;
maybeConvo . set ( 'lastJoinedTimestamp' , _ . toNumber ( envelope . timestamp ) ) ;
} else {
log . warn (
'Ignoring a closed group message of type NEW: the conversation already exists'
@ -242,6 +242,12 @@ export async function handleNewClosedGroup(
// the sending pipeline needs to know from GroupUtils when a message is for a medium group
await ClosedGroup . updateOrCreateClosedGroup ( groupDetails ) ;
// ClosedGroup.updateOrCreateClosedGroup will mark the activeAt to Date.now if it's active
// But we need to override this value with the sent timestamp of the message creating this group for us.
// Having that timestamp set will allow us to pickup incoming group update which were sent between
// envelope.timestamp and Date.now(). And we need to listen to those (some might even remove us)
convo . set ( 'lastJoinedTimestamp' , _ . toNumber ( envelope . timestamp ) ) ;
await convo . commit ( ) ;
// sanity checks validate this
// tslint:disable: no-non-null-assertion