From d78a57ce47f9010154835691e54b7296bb585791 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 24 Apr 2022 06:34:00 +0900 Subject: [PATCH] Implement Reshare::to_ativity07() --- plume-models/src/reshares.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plume-models/src/reshares.rs b/plume-models/src/reshares.rs index 05c5cc56..f2e8ee80 100644 --- a/plume-models/src/reshares.rs +++ b/plume-models/src/reshares.rs @@ -76,6 +76,21 @@ impl Reshare { Ok(act) } + pub fn to_activity07(&self, conn: &Connection) -> Result { + let mut act = Announce07::new( + User::get(conn, self.user_id)?.ap_url.parse::()?, + Post::get(conn, self.post_id)?.ap_url.parse::()?, + ); + act.set_id(self.ap_url.parse::()?); + act.set_many_tos(vec![PUBLIC_VISIBILITY.parse::()?]); + act.set_many_ccs(vec![self + .get_user(conn)? + .followers_endpoint + .parse::()?]); + + Ok(act) + } + pub fn notify(&self, conn: &Connection) -> Result<()> { let post = self.get_post(conn)?; for author in post.get_authors(conn)? {