mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-26 21:41:04 +00:00
Implement Reshare::build_undo07()
This commit is contained in:
parent
c814ac5681
commit
46f4676efb
1 changed files with 16 additions and 0 deletions
|
@ -5,6 +5,7 @@ use crate::{
|
||||||
use activitypub::activity::{Announce, Undo};
|
use activitypub::activity::{Announce, Undo};
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
activity::{ActorAndObjectRef, Announce as Announce07, Undo as Undo07},
|
activity::{ActorAndObjectRef, Announce as Announce07, Undo as Undo07},
|
||||||
|
base::AnyBase,
|
||||||
iri_string::types::IriString,
|
iri_string::types::IriString,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
|
@ -126,6 +127,21 @@ impl Reshare {
|
||||||
|
|
||||||
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![self
|
||||||
|
.get_user(conn)?
|
||||||
|
.followers_endpoint
|
||||||
|
.parse::<IriString>()?]);
|
||||||
|
|
||||||
|
Ok(act)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsObject<User, Announce, &DbConn> for Post {
|
impl AsObject<User, Announce, &DbConn> for Post {
|
||||||
|
|
Loading…
Reference in a new issue