From 93f61ea0dee9699103f9eefbb0e6885c5350baf9 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 23 Jul 2024 14:50:53 +0200 Subject: [PATCH] fix(web): notifications ignore filters --- web/src/activities/item.rs | 8 ++++---- web/src/app.rs | 2 +- web/src/objects/item.rs | 5 +---- web/src/timeline/feed.rs | 8 ++++++-- web/src/timeline/thread.rs | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/web/src/activities/item.rs b/web/src/activities/item.rs index d2e09e4..0b3b85a 100644 --- a/web/src/activities/item.rs +++ b/web/src/activities/item.rs @@ -42,27 +42,27 @@ pub fn ActivityLine(activity: crate::Object) -> impl IntoView { pub fn Item( item: crate::Object, #[prop(optional)] sep: bool, - #[prop(optional)] replies: bool, #[prop(optional)] slim: bool, + #[prop(optional)] always: bool, ) -> impl IntoView { let config = use_context::>().expect("missing config context"); let id = item.id().unwrap_or_default().to_string(); let sep = if sep { Some(view! {
}) } else { None }; move || { - if !replies && !config.get().filters.visible(&item) { + if !always && !config.get().filters.visible(&item) { return None; } match item.object_type().unwrap_or(apb::ObjectType::Object) { // special case for placeholder activities apb::ObjectType::Note | apb::ObjectType::Document(_) => - Some(view! { {sep.clone()} }.into_view()), + Some(view! { {sep.clone()} }.into_view()), // everything else apb::ObjectType::Activity(t) => { let object_id = item.object().id().str().unwrap_or_default(); let object = match t { apb::ActivityType::Create | apb::ActivityType::Announce => cache::OBJECTS.get(&object_id).map(|obj| { - view! { } + view! { } }.into_view()), apb::ActivityType::Follow => cache::OBJECTS.get(&object_id).map(|obj| { diff --git a/web/src/app.rs b/web/src/app.rs index 9b9ef5b..befd96f 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -134,7 +134,7 @@ pub fn App() -> impl IntoView { } /> } /> } /> - } /> + } /> } /> diff --git a/web/src/objects/item.rs b/web/src/objects/item.rs index e8f9ea5..332c838 100644 --- a/web/src/objects/item.rs +++ b/web/src/objects/item.rs @@ -6,10 +6,7 @@ use crate::prelude::*; use apb::{field::OptionalString, target::Addressed, ActivityMut, Base, Collection, CollectionMut, Object, ObjectMut}; #[component] -pub fn Object( - object: crate::Object, - #[prop(optional)] reply: bool, -) -> impl IntoView { +pub fn Object(object: crate::Object) -> impl IntoView { let oid = object.id().unwrap_or_default().to_string(); let author_id = object.attributed_to().id().str().unwrap_or_default(); let author = cache::OBJECTS.get_or(&author_id, serde_json::Value::String(author_id.clone()).into()); diff --git a/web/src/timeline/feed.rs b/web/src/timeline/feed.rs index 0a93fd8..4873bff 100644 --- a/web/src/timeline/feed.rs +++ b/web/src/timeline/feed.rs @@ -4,7 +4,11 @@ use crate::prelude::*; use super::Timeline; #[component] -pub fn Feed(tl: Timeline) -> impl IntoView { +pub fn Feed( + tl: Timeline, + #[prop(optional)] + ignore_filters: bool, +) -> impl IntoView { let auth = use_context::().expect("missing auth context"); if let Some(auto_scroll) = use_context::>() { let _ = leptos::watch( @@ -22,7 +26,7 @@ pub fn Feed(tl: Timeline) -> impl IntoView { > {match cache::OBJECTS.get(&id) { Some(i) => view! { - + }.into_view(), None => view! {

{id}" "[go]

diff --git a/web/src/timeline/thread.rs b/web/src/timeline/thread.rs index ca88fae..eafb801 100644 --- a/web/src/timeline/thread.rs +++ b/web/src/timeline/thread.rs @@ -64,7 +64,7 @@ fn FeedRecursive(tl: Timeline, root: String) -> impl IntoView { children=move |(id, obj)| view! {
- +