Implement Follow::build_undo07()

This commit is contained in:
Kitaiti Makoto 2022-04-24 03:45:22 +09:00
parent 5f91345d69
commit 174624f5c1
1 changed files with 16 additions and 0 deletions

View File

@ -191,6 +191,22 @@ impl Follow {
.set_cc_link_vec(vec![Id::new(PUBLIC_VISIBILITY.to_string())])?;
Ok(undo)
}
pub fn build_undo07(&self, conn: &Connection) -> Result<Undo07> {
let mut undo = Undo07::new(
User::get(conn, self.follower_id)?
.ap_url
.parse::<IriString>()?,
self.ap_url.parse::<IriString>()?,
);
undo.set_id(format!("{}/undo", self.ap_url).parse::<IriString>()?);
undo.set_many_tos(vec![User::get(conn, self.following_id)?
.ap_url
.parse::<IriString>()?]);
undo.set_many_ccs(vec![PUBLIC_VISIBILITY.parse::<IriString>()?]);
Ok(undo)
}
}
impl AsObject<User, FollowAct, &DbConn> for User {