diff --git a/plume-models/src/follows.rs b/plume-models/src/follows.rs index 8061e5fb..1c48879b 100644 --- a/plume-models/src/follows.rs +++ b/plume-models/src/follows.rs @@ -155,6 +155,28 @@ impl Follow { Ok(accept) } + pub fn build_accept07 + IntoId, T>( + &self, + from: &B, + target: &A, + follow: FollowAct07, + ) -> Result { + let mut accept = Accept07::new( + target.clone().into_id().parse::()?, + AnyBase::from_extended(follow)?, + ); + let accept_id = ap_url(&format!( + "{}/follows/{}/accept", + CONFIG.base_url.as_str(), + self.id + )); + accept.set_id(accept_id.parse::()?); + accept.set_many_tos(vec![from.clone().into_id().parse::()?]); + accept.set_many_ccs(vec![PUBLIC_VISIBILITY.parse::()?]); + + Ok(accept) + } + pub fn build_undo(&self, conn: &Connection) -> Result { let mut undo = Undo::default(); undo.undo_props