mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-14 07:51:01 +00:00
Implement Post::update_activity07()
This commit is contained in:
parent
871618f45d
commit
16e012ba00
1 changed files with 17 additions and 1 deletions
|
@ -10,7 +10,7 @@ use activitypub::{
|
|||
CustomObject,
|
||||
};
|
||||
use activitystreams::{
|
||||
activity::Create as Create07,
|
||||
activity::{Create as Create07, Update as Update07},
|
||||
base::{AnyBase, Base},
|
||||
iri_string::types::IriString,
|
||||
object::{ApObject, Article as Article07, Image as Image07},
|
||||
|
@ -539,6 +539,22 @@ impl Post {
|
|||
Ok(act)
|
||||
}
|
||||
|
||||
pub fn update_activity07(&self, conn: &Connection) -> Result<Update07> {
|
||||
let article = self.to_activity07(conn)?;
|
||||
let to = article.to().ok_or(Error::MissingApProperty)?.clone();
|
||||
let cc = article.cc().ok_or(Error::MissingApProperty)?.clone();
|
||||
let mut act = Update07::new(
|
||||
self.get_authors(conn)?[0].ap_url.parse::<IriString>()?,
|
||||
Base::retract(article)?.into_generic()?,
|
||||
);
|
||||
act.set_id(
|
||||
format!("{}/update-{}", self.ap_url, Utc::now().timestamp()).parse::<IriString>()?,
|
||||
);
|
||||
act.set_many_tos(to);
|
||||
act.set_many_ccs(cc);
|
||||
Ok(act)
|
||||
}
|
||||
|
||||
pub fn update_mentions(&self, conn: &Connection, mentions: Vec<link::Mention>) -> Result<()> {
|
||||
let mentions = mentions
|
||||
.into_iter()
|
||||
|
|
Loading…
Reference in a new issue