From 4ea29d29a038fa38685b925f6cf56d4cc9ef387c Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 24 Apr 2022 06:58:33 +0900 Subject: [PATCH] Implement Like::to_activity07() --- plume-models/src/likes.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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)? {