add: option to clear all notifications when you open the page
This commit is contained in:
parent
45ea91a768
commit
e7c4cf14aa
5 changed files with 19 additions and 3 deletions
|
@ -49,6 +49,6 @@
|
||||||
(text "setTimeout(async () => {
|
(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 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;
|
(await ns(\"ui\")).IO_DATA_DISABLE_RELOAD = true;
|
||||||
});"))
|
}, 500);"))
|
||||||
|
|
||||||
(text "{% endblock %}")
|
(text "{% endblock %}")
|
||||||
|
|
|
@ -1536,6 +1536,11 @@
|
||||||
\"{{ profile.settings.paged_timelines }}\",
|
\"{{ profile.settings.paged_timelines }}\",
|
||||||
\"checkbox\",
|
\"checkbox\",
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
[\"auto_clear_notifs\", \"Automatically clear all notifications when you open the notifications page\"],
|
||||||
|
\"{{ profile.settings.auto_clear_notifs }}\",
|
||||||
|
\"checkbox\",
|
||||||
|
],
|
||||||
[[], \"Fun\", \"title\"],
|
[[], \"Fun\", \"title\"],
|
||||||
[
|
[
|
||||||
[\"disable_gpa_fun\", \"Disable GPA\"],
|
[\"disable_gpa_fun\", \"Disable GPA\"],
|
||||||
|
|
|
@ -81,7 +81,7 @@ pub async fn stripe_webhook(
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if retries >= 5 {
|
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
|
// going to happen
|
||||||
//
|
//
|
||||||
// we're going to report this error to the audit log so someone can
|
// we're going to report this error to the audit log so someone can
|
||||||
|
@ -111,7 +111,7 @@ pub async fn stripe_webhook(
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
tracing::info!("checkout session not stored in db yet");
|
tracing::info!("checkout session not stored in db yet");
|
||||||
retries += 1;
|
retries += 1;
|
||||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
tokio::time::sleep(Duration::from_secs(5)).await;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,6 +331,14 @@ pub async fn notifications_request(
|
||||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
|
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 lang = get_lang!(jar, data.0);
|
||||||
let mut context = initial_context(&data.0.0.0, lang, &Some(user)).await;
|
let mut context = initial_context(&data.0.0.0, lang, &Some(user)).await;
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,9 @@ pub struct UserSettings {
|
||||||
/// Hide posts that are answering a question on the "All" timeline.
|
/// Hide posts that are answering a question on the "All" timeline.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub all_timeline_hide_answers: bool,
|
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 {
|
fn mime_avif() -> String {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue