diff --git a/plume-models/src/follows.rs b/plume-models/src/follows.rs index 3ebbef82..b31611d9 100644 --- a/plume-models/src/follows.rs +++ b/plume-models/src/follows.rs @@ -71,6 +71,19 @@ impl Follow { Ok(act) } + pub fn to_activity07(&self, conn: &Connection) -> Result { + let user = User::get(conn, self.follower_id)?; + let target = User::get(conn, self.following_id)?; + let target_id = target.ap_url.parse::()?; + + let mut act = FollowAct07::new(user.ap_url.parse::()?, target_id.clone()); + act.set_id(self.ap_url.parse::()?); + act.set_many_tos(vec![target_id]); + act.set_many_ccs(vec![PUBLIC_VISIBILITY.parse::()?]); + + Ok(act) + } + pub fn notify(&self, conn: &Connection) -> Result<()> { if User::get(conn, self.following_id)?.is_local() { Notification::insert(