Ignore Announce(Dislike) activities

This commit is contained in:
silverpill 2022-12-14 16:34:30 +00:00
parent 68f7b046a1
commit a14c719d25
2 changed files with 5 additions and 2 deletions

View file

@ -6,7 +6,7 @@ use crate::activitypub::{
fetcher::helpers::{get_or_import_profile_by_actor_id, import_post}, fetcher::helpers::{get_or_import_profile_by_actor_id, import_post},
identifiers::parse_local_object_id, identifiers::parse_local_object_id,
receiver::deserialize_into_object_id, receiver::deserialize_into_object_id,
vocabulary::{CREATE, LIKE, NOTE, UNDO, UPDATE}, vocabulary::{CREATE, DISLIKE, LIKE, NOTE, UNDO, UPDATE},
}; };
use crate::config::Config; use crate::config::Config;
use crate::database::DatabaseError; use crate::database::DatabaseError;
@ -31,7 +31,9 @@ pub async fn handle_announce(
db_client: &mut impl GenericClient, db_client: &mut impl GenericClient,
activity: Value, activity: Value,
) -> HandlerResult { ) -> HandlerResult {
if let Some(CREATE | LIKE | UNDO | UPDATE) = activity["object"]["type"].as_str() { if let Some(CREATE | DISLIKE | LIKE | UNDO | UPDATE) =
activity["object"]["type"].as_str()
{
// Ignore wrapped activities from Lemmy // Ignore wrapped activities from Lemmy
// https://codeberg.org/fediverse/fep/src/branch/main/feps/fep-1b12.md // https://codeberg.org/fediverse/fep/src/branch/main/feps/fep-1b12.md
return Ok(None); return Ok(None);

View file

@ -6,6 +6,7 @@ pub const ADD: &str = "Add";
pub const ANNOUNCE: &str = "Announce"; pub const ANNOUNCE: &str = "Announce";
pub const CREATE: &str = "Create"; pub const CREATE: &str = "Create";
pub const DELETE: &str = "Delete"; pub const DELETE: &str = "Delete";
pub const DISLIKE: &str = "Dislike";
pub const EMOJI_REACT: &str = "EmojiReact"; pub const EMOJI_REACT: &str = "EmojiReact";
pub const FOLLOW: &str = "Follow"; pub const FOLLOW: &str = "Follow";
pub const LIKE: &str = "Like"; pub const LIKE: &str = "Like";