Bluesky app fork with some witchin' additions 💫

Fix birthday bug being perpetually snoozed (#9488)

authored by

Eric Bailey and committed by
GitHub
db81cefb 89223d92

+23 -4
+14 -4
src/ageAssurance/data.tsx
··· 15 15 import {networkRetry} from '#/lib/async/retry' 16 16 import {PUBLIC_BSKY_SERVICE} from '#/lib/constants' 17 17 import {getAge} from '#/lib/strings/time' 18 - import {snoozeBirthdateUpdateAllowedForDid} from '#/state/birthdate' 18 + import { 19 + hasSnoozedBirthdateUpdateForDid, 20 + snoozeBirthdateUpdateAllowedForDid, 21 + } from '#/state/birthdate' 19 22 import {useAgent, useSession} from '#/state/session' 20 23 import * as debug from '#/ageAssurance/debug' 21 24 import {logger} from '#/ageAssurance/logger' ··· 331 334 } 332 335 333 336 /** 334 - * If the user is under the minimum age, and the birthdate is not due to 335 - * the legacy bug, snooze further birthdate updates for this user. 337 + * If the user is under the minimum age, and the birthdate is not due to the 338 + * legacy bug, AND we've not already snoozed their birthdate update, snooze 339 + * further birthdate updates for this user. 340 + * 341 + * This is basically a migration step for this initial rollout. 336 342 */ 337 - if (data.birthdate && !isLegacyBirthdateBug(data.birthdate)) { 343 + if ( 344 + data.birthdate && 345 + !isLegacyBirthdateBug(data.birthdate) && 346 + !hasSnoozedBirthdateUpdateForDid(did!) 347 + ) { 338 348 snoozeBirthdateUpdateAllowedForDid(did!) 339 349 } 340 350
+9
src/state/birthdate.ts
··· 21 21 } 22 22 23 23 /** 24 + * Checks if we've already snoozed bday updates. In some cases, if one is 25 + * present, we don't need to set another, such as in AA when reading initial 26 + * data on load. 27 + */ 28 + export function hasSnoozedBirthdateUpdateForDid(did: string) { 29 + return !!account.get([did, 'birthdateLastUpdatedAt']) 30 + } 31 + 32 + /** 24 33 * Returns whether a birthdate update is currently allowed, based on the 25 34 * last update timestamp stored locally. 26 35 */