diff --git a/web/Cargo.toml b/web/Cargo.toml
index 6c23db76..029f985b 100644
--- a/web/Cargo.toml
+++ b/web/Cargo.toml
@@ -24,7 +24,7 @@ leptos = { version = "0.6", features = ["csr", "tracing"] }
leptos_router = { version = "0.6", features = ["csr"] }
leptos-use = { version = "0.10", features = ["serde"] }
reqwest = { version = "0.12", features = ["json"] }
-apb = { path = "../apb", features = ["unstructured"] }
+apb = { path = "../apb", features = ["unstructured", "activitypub-fe", "activitypub-counters"] }
futures = "0.3.30"
dissolve = "0.2" # TODO strip html without this crate
lazy_static = "1.4"
diff --git a/web/src/components/object.rs b/web/src/components/object.rs
index 9118c43f..8863894f 100644
--- a/web/src/components/object.rs
+++ b/web/src/components/object.rs
@@ -90,12 +90,11 @@ pub fn Object(object: crate::Object) -> impl IntoView {
.collect_view();
let comments = object.replies().get()
.map_or(0, |x| x.total_items().unwrap_or(0));
- let shares = object.generator().get()
+ let shares = object.shares().get()
.map_or(0, |x| x.total_items().unwrap_or(0));
- let likes = object.audience().get()
+ let likes = object.likes().get()
.map_or(0, |x| x.total_items().unwrap_or(0));
- let already_liked = object.audience().get()
- .map_or(false, |x| !x.ordered_items().is_empty()); // TODO check if contains my uid
+ let already_liked = object.liked_by_me().unwrap_or(false);
let attachments_padding = if object.attachment().is_empty() {
None
} else {
diff --git a/web/src/page.rs b/web/src/page.rs
index f58305a0..99117ad5 100644
--- a/web/src/page.rs
+++ b/web/src/page.rs
@@ -97,24 +97,16 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
Some(view! { "["{actor_type.as_ref().to_lowercase()}"]" } )
};
let created = object.published();
- let following = object.generator().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0);
- let followers = object.audience().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0);
- let statuses = object.replies().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0);
+ let following = object.following_count().unwrap_or(0);
+ let followers = object.followers_count().unwrap_or(0);
+ let statuses = object.statuses_count().unwrap_or(0);
let tl_url = format!("{}/outbox/page", Uri::api(FetchKind::User, &id.clone(), false));
if !tl.next.get().starts_with(&tl_url) {
tl.reset(tl_url);
}
- let _uid = uid.clone(); // TODO ughhhh
- let followed_by_me = object.audience()
- .get()
- .filter(|x| x.ordered_items().is_empty()) // TODO check if contains my uid
- .map(|_| view! { }.into_view())
- .unwrap_or(view! { following
}.into_view());
-
- // let following_me = object.generator()
- // .get()
- // .filter(|x| !x.ordered_items().is_empty()) // TODO check if contains my uid
- // .map(|_| view! { });
+ let following_me = object.following_me().unwrap_or(false);
+ let followed_by_me = object.followed_by_me().unwrap_or(false);
+ let _uid = uid.clone();
view! {
following
}.into_view()
+ } else {
+ view! { }.into_view()
+ }}
+ {if following_me {
+ Some(view! { follows you
})
+ } else {
+ None
+ }}
{ dissolve::strip_html_tags(&summary)