Implement Reshare::to_ativity07()

This commit is contained in:
Kitaiti Makoto 2022-04-24 06:34:00 +09:00
parent 10acbdd41f
commit d78a57ce47

View file

@ -76,6 +76,21 @@ impl Reshare {
Ok(act)
}
pub fn to_activity07(&self, conn: &Connection) -> Result<Announce07> {
let mut act = Announce07::new(
User::get(conn, self.user_id)?.ap_url.parse::<IriString>()?,
Post::get(conn, self.post_id)?.ap_url.parse::<IriString>()?,
);
act.set_id(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)
}
pub fn notify(&self, conn: &Connection) -> Result<()> {
let post = self.get_post(conn)?;
for author in post.get_authors(conn)? {