Study: lesson reminders on by default for new accounts; one-time backfill turns them on for existing accounts; v2.46.0
Publish Container / build (push) Successful in 16m7s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-19 16:53:03 -04:00
1 parent a11adf8ad2
commit 30a7e8a6cb
5 files changed
+27 -2

No files matched your search

+1
View File
@@ -1421,6 +1421,7 @@ export function sanitizeStudyUsers(value) {
remindersPausedUntil: typeof item?.remindersPausedUntil === 'string' ? item.remindersPausedUntil : null,
reminderFrequency: item?.reminderFrequency === 'weekly' ? 'weekly' : 'immediate',
weeklyDigestSentAt: typeof item?.weeklyDigestSentAt === 'string' ? item.weeklyDigestSentAt : null,
remindersDefaultedAt: typeof item?.remindersDefaultedAt === 'string' ? item.remindersDefaultedAt : null,
})
}
return out.slice(0, MAX_STUDY_USERS)
+2 -1
View File
@@ -117,7 +117,8 @@ export function register(app) {
passwordHash: hashStudyPassword(password),
displayName,
subscribeNewsletter: subscribe,
studyRemindersEnabled: false,
studyRemindersEnabled: true,
remindersDefaultedAt: now,
pendingEmailChange: null,
emailVerified: false,
pendingEmailVerification: {
+17
View File
@@ -736,6 +736,23 @@ export function extractResendMessageId(result) {
return ''
}
// One-off pass: lesson reminders are now on by default, so switch them on for accounts that
// predate the default. Each account is marked as it is handled, so a later opt-out sticks.
export async function backfillReminderDefault() {
const now = new Date().toISOString()
let updated = 0
for (const user of state.studyUsers) {
if (user.remindersDefaultedAt) continue
if (user.studyRemindersEnabled !== true) {
user.studyRemindersEnabled = true
updated++
}
user.remindersDefaultedAt = now
}
if (state.studyUsers.some(user => user.remindersDefaultedAt === now)) queueStudyUsersWrite()
return updated
}
// ── Study reminder scheduler ───────────────────────────────────────────────
export async function scheduleStudyReminders(sendStudyReminderEmail) {