File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1474,7 +1474,19 @@ export class ConversationModel extends Model<ConversationAttributes> {
1474
1474
newProfile : SetSessionProfileDetails
1475
1475
) : newProfile is Extract < T , { profileUpdatedAtSeconds : number } > {
1476
1476
if ( isSetProfileWithUpdatedAtSeconds ( newProfile ) ) {
1477
+ // For the transition period, we need to allow an incoming profile to be applied when
1478
+ // the timestamp is not set (defaults to 0).
1479
+ if ( newProfile . profileUpdatedAtSeconds === 0 && this . getProfileUpdatedSeconds ( ) === 0 ) {
1480
+ window . log . debug (
1481
+ `shouldApplyPrivateProfileUpdate for ${ ed25519Str ( this . id ) } incomingSeconds:0 currentSeconds:0. Allowing overwrite`
1482
+ ) ;
1483
+ return true ;
1484
+ }
1477
1485
const ts = new Timestamp ( { value : newProfile . profileUpdatedAtSeconds } ) ;
1486
+ window . log . debug (
1487
+ `shouldApplyPrivateProfileUpdate for ${ ed25519Str ( this . id ) } incomingSeconds:${ ts . seconds ( ) } currentSeconds:${ this . getProfileUpdatedSeconds ( ) } -> ${ this . getProfileUpdatedSeconds ( ) < ts . seconds ( ) } `
1488
+ ) ;
1489
+
1478
1490
return this . getProfileUpdatedSeconds ( ) < ts . seconds ( ) ;
1479
1491
}
1480
1492
// for non private setProfile calls, we do not need to check the updatedAtSeconds
Original file line number Diff line number Diff line change @@ -233,6 +233,10 @@ export type WithAvatarPointer = {
233
233
} ;
234
234
235
235
export type WithProfileUpdatedAtSeconds = {
236
+ /**
237
+ * 0 is allowed for the transition period (until enough users have migrated to sending their profileUpdatedAtSeconds).
238
+ * Allowed as in an incoming message with a lokiProfile updated at 0, will be applied locally, if needed
239
+ */
236
240
profileUpdatedAtSeconds : number ;
237
241
} ;
238
242
You can’t perform that action at this time.
0 commit comments