diff --git a/plume-models/src/reshares.rs b/plume-models/src/reshares.rs index 6f74de55..88269020 100644 --- a/plume-models/src/reshares.rs +++ b/plume-models/src/reshares.rs @@ -5,6 +5,7 @@ use crate::{ use activitypub::activity::{Announce, Undo}; use activitystreams::{ activity::{ActorAndObjectRef, Announce as Announce07, Undo as Undo07}, + base::AnyBase, iri_string::types::IriString, prelude::*, }; @@ -126,6 +127,21 @@ impl Reshare { Ok(act) } + + pub fn build_undo07(&self, conn: &Connection) -> Result { + let mut act = Undo07::new( + User::get(conn, self.user_id)?.ap_url.parse::()?, + AnyBase::from_extended(self.to_activity07(conn)?)?, + ); + act.set_id(format!("{}#delete", 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) + } } impl AsObject for Post {