From db81cefb866ccb0fb0d1f77804727b2edebd0f79 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 5 Dec 2025 12:17:43 -0600 Subject: [PATCH] Fix birthday bug being perpetually snoozed (#9488) --- src/ageAssurance/data.tsx | 18 ++++++++++++++---- src/state/birthdate.ts | 9 +++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/ageAssurance/data.tsx b/src/ageAssurance/data.tsx index 24619890c8..ab6cb00105 100644 --- a/src/ageAssurance/data.tsx +++ b/src/ageAssurance/data.tsx @@ -15,7 +15,10 @@ import debounce from 'lodash.debounce' import {networkRetry} from '#/lib/async/retry' import {PUBLIC_BSKY_SERVICE} from '#/lib/constants' import {getAge} from '#/lib/strings/time' -import {snoozeBirthdateUpdateAllowedForDid} from '#/state/birthdate' +import { + hasSnoozedBirthdateUpdateForDid, + snoozeBirthdateUpdateAllowedForDid, +} from '#/state/birthdate' import {useAgent, useSession} from '#/state/session' import * as debug from '#/ageAssurance/debug' import {logger} from '#/ageAssurance/logger' @@ -331,10 +334,17 @@ export async function getOtherRequiredData({ } /** - * If the user is under the minimum age, and the birthdate is not due to - * the legacy bug, snooze further birthdate updates for this user. + * If the user is under the minimum age, and the birthdate is not due to the + * legacy bug, AND we've not already snoozed their birthdate update, snooze + * further birthdate updates for this user. + * + * This is basically a migration step for this initial rollout. */ - if (data.birthdate && !isLegacyBirthdateBug(data.birthdate)) { + if ( + data.birthdate && + !isLegacyBirthdateBug(data.birthdate) && + !hasSnoozedBirthdateUpdateForDid(did!) + ) { snoozeBirthdateUpdateAllowedForDid(did!) } diff --git a/src/state/birthdate.ts b/src/state/birthdate.ts index bfa3e9561f..24dc1a846e 100644 --- a/src/state/birthdate.ts +++ b/src/state/birthdate.ts @@ -20,6 +20,15 @@ export function snoozeBirthdateUpdateAllowedForDid(did: string) { account.set([did, 'birthdateLastUpdatedAt'], new Date().toISOString()) } +/** + * Checks if we've already snoozed bday updates. In some cases, if one is + * present, we don't need to set another, such as in AA when reading initial + * data on load. + */ +export function hasSnoozedBirthdateUpdateForDid(did: string) { + return !!account.get([did, 'birthdateLastUpdatedAt']) +} + /** * Returns whether a birthdate update is currently allowed, based on the * last update timestamp stored locally.