mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-23 03:51:00 +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,
|
CustomObject,
|
||||||
};
|
};
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
activity::Create as Create07,
|
activity::{Create as Create07, Update as Update07},
|
||||||
base::{AnyBase, Base},
|
base::{AnyBase, Base},
|
||||||
iri_string::types::IriString,
|
iri_string::types::IriString,
|
||||||
object::{ApObject, Article as Article07, Image as Image07},
|
object::{ApObject, Article as Article07, Image as Image07},
|
||||||
|
@ -539,6 +539,22 @@ impl Post {
|
||||||
Ok(act)
|
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<()> {
|
pub fn update_mentions(&self, conn: &Connection, mentions: Vec<link::Mention>) -> Result<()> {
|
||||||
let mentions = mentions
|
let mentions = mentions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
Loading…
Reference in a new issue