Implement Reshare::build_undo07()

This commit is contained in:
Kitaiti Makoto 2022-04-24 06:48:31 +09:00
parent c814ac5681
commit 46f4676efb

View File

@ -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<Undo07> {
let mut act = Undo07::new(
User::get(conn, self.user_id)?.ap_url.parse::<IriString>()?,
AnyBase::from_extended(self.to_activity07(conn)?)?,
);
act.set_id(format!("{}#delete", self.ap_url).parse::<IriString>()?);
act.set_many_tos(vec![PUBLIC_VISIBILITY.parse::<IriString>()?]);
act.set_many_ccs(vec![self
.get_user(conn)?
.followers_endpoint
.parse::<IriString>()?]);
Ok(act)
}
}
impl AsObject<User, Announce, &DbConn> for Post {