fix(web): turbo ghetto way to mark notifs as seen

this is really bad but i got soooo annoyed by how notifications work rn
This commit is contained in:
əlemi 2025-01-09 17:06:49 +01:00
parent 025c80f6e2
commit 6541a39223
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -125,12 +125,17 @@ fn AckBtn(id: String, tx: WriteSignal<bool>) -> impl IntoView {
let payload = apb::new() let payload = apb::new()
.set_activity_type(Some(apb::ActivityType::View)) .set_activity_type(Some(apb::ActivityType::View))
.set_object(apb::Node::link(id.clone())); .set_object(apb::Node::link(id.clone()));
let id = id.clone();
spawn_local(async move { spawn_local(async move {
if let Err(e) = Http::post(&auth.outbox(), &payload, auth).await { if let Err(e) = Http::post(&auth.outbox(), &payload, auth).await {
tracing::error!("failed marking notification as seen: {e}"); tracing::error!("failed marking notification as seen: {e}");
} else { } else {
tx.set(false); tx.set(false);
set_notifications.set(notifications.get() - 1); 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));
}
} }
}); });
} }