Make Undo/Block work for remote mods

This commit is contained in:
Felix Ableitner 2021-04-09 14:29:39 +02:00
parent 01a514f969
commit 80ce7f19ec
3 changed files with 14 additions and 1 deletions

View File

@ -208,6 +208,7 @@ impl CommunityType for Community {
.set_to(public())
.set_many_ccs(ccs);
dbg!(&object_actor_inbox);
send_to_community_followers(announce, self, object_actor_inbox, context).await?;
Ok(())

View File

@ -241,7 +241,18 @@ pub(crate) async fn community_receive_message(
if do_announce {
// Check again that the activity is public, just to be sure
verify_is_addressed_to_public(&activity)?;
let object_actor = activity.object().clone().single_xsd_any_uri();
let mut object_actor = activity.object().clone().single_xsd_any_uri();
// If activity is something like Undo/Block, we need to access activity.object.object
if object_actor.is_none() {
object_actor = activity
.object()
.as_one()
.map(|a| ActorAndObject::from_any_base(a.to_owned()).ok())
.flatten()
.flatten()
.map(|a: ActorAndObject<CommunityValidTypes>| a.object().to_owned().single_xsd_any_uri())
.flatten();
}
to_community
.send_announce(activity.into_any_base()?, object_actor, context)
.await?;

View File

@ -34,6 +34,7 @@ pub enum ValidTypes {
Remove,
Announce,
Add,
Block,
}
// TODO: this isnt entirely correct, cause some of these receive are not ActorAndObject,