Handle Delete activities that don't have object type
This commit is contained in:
parent
3b5ec45991
commit
bbf696fe6e
3 changed files with 11 additions and 6 deletions
|
@ -79,7 +79,7 @@ The following activities are supported:
|
|||
- Accept(Follow)
|
||||
- Reject(Follow)
|
||||
- Create(Note)
|
||||
- Delete(Tombstone)
|
||||
- Delete(Note)
|
||||
- Like(Note)
|
||||
- Follow(Person)
|
||||
- Undo(Follow)
|
||||
|
|
|
@ -292,10 +292,16 @@ pub async fn receive_activity(
|
|||
.map_err(|_| ValidationError("invalid object"))?;
|
||||
process_note(config, db_client, object).await?;
|
||||
},
|
||||
(DELETE, TOMBSTONE) => {
|
||||
(DELETE, _) => {
|
||||
let object_id = match activity.object.as_str() {
|
||||
Some(object_id) => object_id.to_owned(),
|
||||
None => {
|
||||
let object: Object = serde_json::from_value(activity.object)
|
||||
.map_err(|_| ValidationError("invalid object"))?;
|
||||
let post = get_post_by_object_id(db_client, &object.id).await?;
|
||||
object.id
|
||||
},
|
||||
};
|
||||
let post = get_post_by_object_id(db_client, &object_id).await?;
|
||||
let deletion_queue = delete_post(db_client, &post.id).await?;
|
||||
let config = config.clone();
|
||||
actix_rt::spawn(async move {
|
||||
|
|
|
@ -19,7 +19,6 @@ pub const DOCUMENT: &str = "Document";
|
|||
pub const IMAGE: &str = "Image";
|
||||
pub const MENTION: &str = "Mention";
|
||||
pub const NOTE: &str = "Note";
|
||||
pub const TOMBSTONE: &str = "Tombstone";
|
||||
|
||||
// Misc
|
||||
pub const PROPERTY_VALUE: &str = "PropertyValue";
|
||||
|
|
Loading…
Reference in a new issue