Ignore Announce(Undo) activities

This commit is contained in:
silverpill 2022-11-14 18:56:42 +00:00
parent 92d96e3745
commit 09cb15297a

View file

@ -5,7 +5,7 @@ use crate::activitypub::{
fetcher::helpers::{get_or_import_profile_by_actor_id, import_post},
identifiers::parse_local_object_id,
receiver::find_object_id,
vocabulary::{CREATE, LIKE, NOTE, UPDATE},
vocabulary::{CREATE, LIKE, NOTE, UNDO, UPDATE},
};
use crate::config::Config;
use crate::errors::DatabaseError;
@ -36,8 +36,9 @@ pub async fn handle_announce(
&config.media_dir(),
&activity.actor,
).await?;
if let Some(CREATE) | Some(LIKE) | Some(UPDATE) = activity.object["type"].as_str() {
// Ignore Announce(Create) activities from Lemmy
if let Some(CREATE | LIKE | UNDO | UPDATE) = activity.object["type"].as_str() {
// Ignore wrapped activities from Lemmy
// https://codeberg.org/fediverse/fep/src/branch/main/feps/fep-1b12.md
return Ok(None);
};
let object_id = find_object_id(&activity.object)?;