diff --git a/crates/app/src/public/html/profile/posts.lisp b/crates/app/src/public/html/profile/posts.lisp index e2454b0..6c417a6 100644 --- a/crates/app/src/public/html/profile/posts.lisp +++ b/crates/app/src/public/html/profile/posts.lisp @@ -49,6 +49,6 @@ (text "setTimeout(async () => { await trigger(\"ui::io_data_load\", [\"/_swiss_army_timeline?user_id={{ profile.id }}&tag={{ tag }}&page=\", Number.parseInt(\"{{ page }}\") - 1, \"{{ paged }}\" === \"true\"]); (await ns(\"ui\")).IO_DATA_DISABLE_RELOAD = true; - });")) + }, 500);")) (text "{% endblock %}") diff --git a/crates/app/src/public/html/profile/settings.lisp b/crates/app/src/public/html/profile/settings.lisp index 0867dda..2b12aa0 100644 --- a/crates/app/src/public/html/profile/settings.lisp +++ b/crates/app/src/public/html/profile/settings.lisp @@ -1536,6 +1536,11 @@ \"{{ profile.settings.paged_timelines }}\", \"checkbox\", ], + [ + [\"auto_clear_notifs\", \"Automatically clear all notifications when you open the notifications page\"], + \"{{ profile.settings.auto_clear_notifs }}\", + \"checkbox\", + ], [[], \"Fun\", \"title\"], [ [\"disable_gpa_fun\", \"Disable GPA\"], diff --git a/crates/app/src/routes/api/v1/auth/connections/stripe.rs b/crates/app/src/routes/api/v1/auth/connections/stripe.rs index b0eaee6..6ef6fcd 100644 --- a/crates/app/src/routes/api/v1/auth/connections/stripe.rs +++ b/crates/app/src/routes/api/v1/auth/connections/stripe.rs @@ -81,7 +81,7 @@ pub async fn stripe_webhook( loop { if retries >= 5 { - // we've already tried 5 times (10 seconds of waiting)... it's not + // we've already tried 5 times (25 seconds of waiting)... it's not // going to happen // // we're going to report this error to the audit log so someone can @@ -111,7 +111,7 @@ pub async fn stripe_webhook( Err(_) => { tracing::info!("checkout session not stored in db yet"); retries += 1; - tokio::time::sleep(Duration::from_secs(2)).await; + tokio::time::sleep(Duration::from_secs(5)).await; continue; } } diff --git a/crates/app/src/routes/pages/misc.rs b/crates/app/src/routes/pages/misc.rs index d83a695..f11c116 100644 --- a/crates/app/src/routes/pages/misc.rs +++ b/crates/app/src/routes/pages/misc.rs @@ -331,6 +331,14 @@ pub async fn notifications_request( Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)), }; + // check and clear + if profile.settings.auto_clear_notifs { + if let Err(e) = data.0.delete_all_notifications(&user).await { + return Err(Html(render_error(e, &jar, &data, &Some(user)).await)); + } + } + + // ... let lang = get_lang!(jar, data.0); let mut context = initial_context(&data.0.0.0, lang, &Some(user)).await; diff --git a/crates/core/src/model/auth.rs b/crates/core/src/model/auth.rs index 64ebc62..d38a576 100644 --- a/crates/core/src/model/auth.rs +++ b/crates/core/src/model/auth.rs @@ -252,6 +252,9 @@ pub struct UserSettings { /// Hide posts that are answering a question on the "All" timeline. #[serde(default)] pub all_timeline_hide_answers: bool, + /// Automatically clear all notifications when notifications are viewed. + #[serde(default)] + pub auto_clear_notifs: bool, } fn mime_avif() -> String {