Implement Like::build_undo07()

This commit is contained in:
Kitaiti Makoto 2022-04-24 07:03:13 +09:00
parent 3093f713ef
commit fcc9e1d81b

View file

@ -102,6 +102,20 @@ impl Like {
Ok(act) 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![User::get(conn, self.user_id)?
.followers_endpoint
.parse::<IriString>()?]);
Ok(act)
}
} }
impl AsObject<User, activity::Like, &DbConn> for Post { impl AsObject<User, activity::Like, &DbConn> for Post {