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:
parent
025c80f6e2
commit
6541a39223
1 changed files with 5 additions and 0 deletions
|
@ -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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue