From 6541a392232f93bc7a75934a82810034fce1a967 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 9 Jan 2025 17:06:49 +0100 Subject: [PATCH] fix(web): turbo ghetto way to mark notifs as seen this is really bad but i got soooo annoyed by how notifications work rn --- web/src/activities/item.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/activities/item.rs b/web/src/activities/item.rs index 81e5461..fc110d5 100644 --- a/web/src/activities/item.rs +++ b/web/src/activities/item.rs @@ -125,12 +125,17 @@ fn AckBtn(id: String, tx: WriteSignal) -> impl IntoView { let payload = apb::new() .set_activity_type(Some(apb::ActivityType::View)) .set_object(apb::Node::link(id.clone())); + let id = id.clone(); spawn_local(async move { if let Err(e) = Http::post(&auth.outbox(), &payload, auth).await { tracing::error!("failed marking notification as seen: {e}"); } else { tx.set(false); set_notifications.set(notifications.get() - 1); + if let Some(activity) = crate::cache::OBJECTS.get(&id) { + let changed = (*activity).clone().set_seen(Some(true)); + crate::cache::OBJECTS.store(&id, std::sync::Arc::new(changed)); + } } }); }