diff --git a/web/src/components/timeline.rs b/web/src/components/timeline.rs index f805862..1f41e83 100644 --- a/web/src/components/timeline.rs +++ b/web/src/components/timeline.rs @@ -1,6 +1,6 @@ use std::{collections::BTreeSet, pin::Pin, sync::Arc}; -use apb::{Activity, Base, Object}; +use apb::{Activity, ActivityMut, Base, Object, ObjectMut}; use leptos::*; use crate::prelude::*; @@ -168,7 +168,12 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView { }.into_view()), apb::ActivityType::Follow => CACHE.get(&object_id).map(|obj| { - view! {
} + view! { +
+ + +
+ } }.into_view()), _ => None, }; @@ -203,7 +208,6 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView { } async fn process_activities(activities: Vec, auth: Auth) -> Vec { - use apb::ActivityMut; let mut sub_tasks : Vec>>> = Vec::new(); let mut gonna_fetch = BTreeSet::new(); let mut actors_seen = BTreeSet::new(); diff --git a/web/src/components/user.rs b/web/src/components/user.rs index f4191f0..a6c0154 100644 --- a/web/src/components/user.rs +++ b/web/src/components/user.rs @@ -1,7 +1,7 @@ use leptos::*; use crate::prelude::*; -use apb::{Actor, Base, Object}; +use apb::{ActivityMut, Actor, Base, Object, ObjectMut}; #[component] pub fn ActorStrip(object: crate::Object) -> impl IntoView { @@ -48,3 +48,56 @@ pub fn ActorBanner(object: crate::Object) -> impl IntoView { } } } + +#[component] +pub fn FollowRequestButtons(activity_id: String, actor_id: String) -> impl IntoView { + let auth = use_context::().expect("missing auth context"); + // TODO lmao what is going on with this double move / triple clone ??????????? + let _activity_id = activity_id.clone(); + let _actor_id = actor_id.clone(); + if actor_id == auth.user_id() { + Some(view! { + + + + }) + } else { + None + } +} + +async fn send_follow_response(kind: apb::ActivityType, target: String, to: String, auth: Auth) { + let payload = serde_json::Value::Object(serde_json::Map::default()) + .set_activity_type(Some(kind)) + .set_object(apb::Node::link(target)) + .set_to(apb::Node::links(vec![to])); + if let Err(e) = Http::post(&auth.outbox(), &payload, auth).await { + tracing::error!("failed posting follow response: {e}"); + } +}