Implement User::delete_activity07()
This commit is contained in:
parent
55ca1345e1
commit
8d69051a61
@ -17,7 +17,7 @@ use activitystreams::{
|
||||
actor::{ApActor as ApActor07, Endpoints as Endpoints07, Person as Person07},
|
||||
collection::OrderedCollection as OrderedCollection07,
|
||||
iri_string::types::IriString,
|
||||
object::{AsObject as _, Image as Image07},
|
||||
object::{AsObject as _, Image as Image07, Tombstone as Tombstone07},
|
||||
prelude::*,
|
||||
};
|
||||
use chrono::{NaiveDateTime, Utc};
|
||||
@ -873,6 +873,25 @@ impl User {
|
||||
Ok(del)
|
||||
}
|
||||
|
||||
pub fn delete_activity07(&self, conn: &Connection) -> Result<Delete07> {
|
||||
let mut tombstone = Tombstone07::new();
|
||||
tombstone.set_id(self.ap_url.parse()?);
|
||||
|
||||
let mut del = Delete07::new(
|
||||
self.ap_url.parse::<IriString>()?,
|
||||
tombstone.into_any_base()?,
|
||||
);
|
||||
del.set_id(format!("{}#delete", self.ap_url).parse()?);
|
||||
del.set_many_tos(vec![PUBLIC_VISIBILITY.parse::<IriString>()?]);
|
||||
del.set_many_ccs(
|
||||
self.get_followers(conn)?
|
||||
.into_iter()
|
||||
.filter_map(|f| f.ap_url.parse::<IriString>().ok()),
|
||||
);
|
||||
|
||||
Ok(del)
|
||||
}
|
||||
|
||||
pub fn avatar_url(&self, conn: &Connection) -> String {
|
||||
self.avatar_id
|
||||
.and_then(|id| Media::get(conn, id).and_then(|m| m.url()).ok())
|
||||
|
Loading…
Reference in New Issue
Block a user