Delete reshares when receiving the corresponding Undo activity

This commit is contained in:
Bat 2018-06-19 10:50:01 +01:00
parent 82d3afe7b6
commit 7fc469fa96

View file

@ -1,6 +1,6 @@
use activitypub::{ use activitypub::{
Object, Object,
activity::{Create, Like, Undo} activity::{Announce, Create, Like, Undo}
}; };
use diesel::PgConnection; use diesel::PgConnection;
use failure::Error; use failure::Error;
@ -90,6 +90,10 @@ pub trait Inbox {
likes::Like::delete_activity(conn, Id::new(act.undo_props.object_object::<Like>()?.object_props.id_string()?)); likes::Like::delete_activity(conn, Id::new(act.undo_props.object_object::<Like>()?.object_props.id_string()?));
Ok(()) Ok(())
}, },
"Announce" => {
Reshare::delete_activity(conn, Id::new(act.undo_props.object_object::<Announce>()?.object_props.id_string()?));
Ok(())
}
_ => Err(InboxError::CantUndo)? _ => Err(InboxError::CantUndo)?
} }
} }