web: fix automatic backup reminder setting reverting to never (#8037)

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
01zulfi
2025-05-01 09:07:30 +05:00
committed by Abdullah Atta
parent 5b09528e7e
commit 6c8dc223f2

View File

@@ -86,9 +86,12 @@ export async function scheduleFullBackups() {
); );
} }
export function shouldAddAutoBackupsDisabledNotice() { export async function shouldAddAutoBackupsDisabledNotice() {
const user = await db.user.getUser();
if (!user) return false;
const backupInterval = Config.get("backupReminderOffset", 0); const backupInterval = Config.get("backupReminderOffset", 0);
if (!isUserPremium() && backupInterval) { if (!isUserPremium(user) && backupInterval) {
Config.set("backupReminderOffset", 0); Config.set("backupReminderOffset", 0);
return true; return true;
} }
@@ -177,7 +180,7 @@ export const NoticesData: Record<NoticeType, NoticeData> = {
export async function resetNotices() { export async function resetNotices() {
const notices: Notice[] = []; const notices: Notice[] = [];
if (shouldAddAutoBackupsDisabledNotice()) { if (await shouldAddAutoBackupsDisabledNotice()) {
notices.push({ type: "autoBackupsOff", priority: 3 }); notices.push({ type: "autoBackupsOff", priority: 3 });
} }
if (await shouldAddBackupNotice()) { if (await shouldAddBackupNotice()) {