fix(web): updated apb fields
This commit is contained in:
parent
bcd8f27933
commit
0435c779c5
3 changed files with 20 additions and 21 deletions
|
@ -24,7 +24,7 @@ leptos = { version = "0.6", features = ["csr", "tracing"] }
|
||||||
leptos_router = { version = "0.6", features = ["csr"] }
|
leptos_router = { version = "0.6", features = ["csr"] }
|
||||||
leptos-use = { version = "0.10", features = ["serde"] }
|
leptos-use = { version = "0.10", features = ["serde"] }
|
||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
apb = { path = "../apb", features = ["unstructured"] }
|
apb = { path = "../apb", features = ["unstructured", "activitypub-fe", "activitypub-counters"] }
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
dissolve = "0.2" # TODO strip html without this crate
|
dissolve = "0.2" # TODO strip html without this crate
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
|
|
|
@ -90,12 +90,11 @@ pub fn Object(object: crate::Object) -> impl IntoView {
|
||||||
.collect_view();
|
.collect_view();
|
||||||
let comments = object.replies().get()
|
let comments = object.replies().get()
|
||||||
.map_or(0, |x| x.total_items().unwrap_or(0));
|
.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));
|
.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));
|
.map_or(0, |x| x.total_items().unwrap_or(0));
|
||||||
let already_liked = object.audience().get()
|
let already_liked = object.liked_by_me().unwrap_or(false);
|
||||||
.map_or(false, |x| !x.ordered_items().is_empty()); // TODO check if contains my uid
|
|
||||||
let attachments_padding = if object.attachment().is_empty() {
|
let attachments_padding = if object.attachment().is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -97,24 +97,16 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
|
||||||
Some(view! { <sup class="ml-s"><small>"["{actor_type.as_ref().to_lowercase()}"]"</small></sup> } )
|
Some(view! { <sup class="ml-s"><small>"["{actor_type.as_ref().to_lowercase()}"]"</small></sup> } )
|
||||||
};
|
};
|
||||||
let created = object.published();
|
let created = object.published();
|
||||||
let following = object.generator().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0);
|
let following = object.following_count().unwrap_or(0);
|
||||||
let followers = object.audience().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0);
|
let followers = object.followers_count().unwrap_or(0);
|
||||||
let statuses = object.replies().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0);
|
let statuses = object.statuses_count().unwrap_or(0);
|
||||||
let tl_url = format!("{}/outbox/page", Uri::api(FetchKind::User, &id.clone(), false));
|
let tl_url = format!("{}/outbox/page", Uri::api(FetchKind::User, &id.clone(), false));
|
||||||
if !tl.next.get().starts_with(&tl_url) {
|
if !tl.next.get().starts_with(&tl_url) {
|
||||||
tl.reset(tl_url);
|
tl.reset(tl_url);
|
||||||
}
|
}
|
||||||
let _uid = uid.clone(); // TODO ughhhh
|
let following_me = object.following_me().unwrap_or(false);
|
||||||
let followed_by_me = object.audience()
|
let followed_by_me = object.followed_by_me().unwrap_or(false);
|
||||||
.get()
|
let _uid = uid.clone();
|
||||||
.filter(|x| x.ordered_items().is_empty()) // TODO check if contains my uid
|
|
||||||
.map(|_| view! { <input type="submit" value="follow" on:click=move |_| send_follow_request(_uid.clone()) /> }.into_view())
|
|
||||||
.unwrap_or(view! { <code class="color">following</code> }.into_view());
|
|
||||||
|
|
||||||
// let following_me = object.generator()
|
|
||||||
// .get()
|
|
||||||
// .filter(|x| !x.ordered_items().is_empty()) // TODO check if contains my uid
|
|
||||||
// .map(|_| view! { <input type="submit" value="remove" /> });
|
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<div class="ml-3 mr-3">
|
<div class="ml-3 mr-3">
|
||||||
|
@ -150,8 +142,16 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="rev mr-1">
|
<div class="rev mr-1">
|
||||||
{followed_by_me}
|
{if followed_by_me {
|
||||||
// {following_me}
|
view! { <code class="color">following</code> }.into_view()
|
||||||
|
} else {
|
||||||
|
view! { <input type="submit" value="follow" on:click=move |_| send_follow_request(_uid.clone()) /> }.into_view()
|
||||||
|
}}
|
||||||
|
{if following_me {
|
||||||
|
Some(view! { <code class="ml-1 color">follows you</code> })
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
<blockquote class="ml-2 mt-1">{
|
<blockquote class="ml-2 mt-1">{
|
||||||
dissolve::strip_html_tags(&summary)
|
dissolve::strip_html_tags(&summary)
|
||||||
|
|
Loading…
Reference in a new issue