diff --git a/plume-models/src/likes.rs b/plume-models/src/likes.rs index 3702d7b4..9a405904 100644 --- a/plume-models/src/likes.rs +++ b/plume-models/src/likes.rs @@ -51,6 +51,20 @@ impl Like { Ok(act) } + pub fn to_activity07(&self, conn: &Connection) -> Result { + let mut act = Like07::new( + User::get(conn, self.user_id)?.ap_url.parse::()?, + Post::get(conn, self.post_id)?.ap_url.parse::()?, + ); + act.set_many_tos(vec![PUBLIC_VISIBILITY.parse::()?]); + act.set_many_ccs(vec![User::get(conn, self.user_id)? + .followers_endpoint + .parse::()?]); + act.set_id(self.ap_url.parse::()?); + + Ok(act) + } + pub fn notify(&self, conn: &Connection) -> Result<()> { let post = Post::get(conn, self.post_id)?; for author in post.get_authors(conn)? {