Implement Comment::builde_delete07()
This commit is contained in:
parent
88eb61c320
commit
08ac7227b5
@ -17,8 +17,12 @@ use activitypub::{
|
|||||||
object::{Note, Tombstone},
|
object::{Note, Tombstone},
|
||||||
};
|
};
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
activity::Create as Create07, base::Base, iri_string::types::IriString, object::Note as Note07,
|
activity::{Create as Create07, Delete as Delete07},
|
||||||
prelude::*, time::OffsetDateTime,
|
base::Base,
|
||||||
|
iri_string::types::IriString,
|
||||||
|
object::{Note as Note07, Tombstone as Tombstone07},
|
||||||
|
prelude::*,
|
||||||
|
time::OffsetDateTime,
|
||||||
};
|
};
|
||||||
use chrono::{self, NaiveDateTime, TimeZone, Utc};
|
use chrono::{self, NaiveDateTime, TimeZone, Utc};
|
||||||
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
||||||
@ -262,6 +266,26 @@ impl Comment {
|
|||||||
|
|
||||||
Ok(act)
|
Ok(act)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn build_delete07(&self, conn: &Connection) -> Result<Delete07> {
|
||||||
|
let mut tombstone = Tombstone07::new();
|
||||||
|
tombstone.set_id(
|
||||||
|
self.ap_url
|
||||||
|
.as_ref()
|
||||||
|
.ok_or(Error::MissingApProperty)?
|
||||||
|
.parse::<IriString>()?,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut act = Delete07::new(
|
||||||
|
self.get_author(conn)?.into_id().parse::<IriString>()?,
|
||||||
|
Base::retract(tombstone)?.into_generic()?,
|
||||||
|
);
|
||||||
|
|
||||||
|
act.set_id(format!("{}#delete", self.ap_url.clone().unwrap()).parse::<IriString>()?);
|
||||||
|
act.set_many_tos(vec![PUBLIC_VISIBILITY.parse::<IriString>()?]);
|
||||||
|
|
||||||
|
Ok(act)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromId<DbConn> for Comment {
|
impl FromId<DbConn> for Comment {
|
||||||
|
Loading…
Reference in New Issue
Block a user