From: Freakazoid182 Date: Wed, 16 Aug 2023 09:36:58 +0000 (+0200) Subject: Add person name to PersonIsBannedFromSite error (#3786) (#3855) X-Git-Url: http://these/git/%7B%60https:/%7Bthis.state.userSettingsForm.avatar%7D?a=commitdiff_plain;h=ee7b35a04af4a200e25893249d8a32d4ceeea2b0;p=lemmy.git Add person name to PersonIsBannedFromSite error (#3786) (#3855) * Add person name to PersonIsBannedFromSite error (#3786) * Log PersonId instead of Person name (#3850) * Log actor_id for PersonIsBannedFromSite (#3850) --------- Co-authored-by: Freek van Zee --- diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index bc8379f1..ad04e861 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -97,7 +97,9 @@ pub(crate) async fn verify_person_in_community( ) -> Result<(), LemmyError> { let person = person_id.dereference(context).await?; if person.banned { - return Err(LemmyErrorType::PersonIsBannedFromSite)?; + return Err(LemmyErrorType::PersonIsBannedFromSite( + person.actor_id.to_string(), + ))?; } let person_id = person.id; let community_id = community.id; diff --git a/crates/apub/src/objects/private_message.rs b/crates/apub/src/objects/private_message.rs index a51cfe6b..9a92b0b5 100644 --- a/crates/apub/src/objects/private_message.rs +++ b/crates/apub/src/objects/private_message.rs @@ -107,7 +107,9 @@ impl Object for ApubPrivateMessage { check_apub_id_valid_with_strictness(note.id.inner(), false, context).await?; let person = note.attributed_to.dereference(context).await?; if person.banned { - return Err(LemmyErrorType::PersonIsBannedFromSite)?; + return Err(LemmyErrorType::PersonIsBannedFromSite( + person.actor_id.to_string(), + ))?; } Ok(()) } diff --git a/crates/utils/src/error.rs b/crates/utils/src/error.rs index 9ddd3b29..0dd9ba6c 100644 --- a/crates/utils/src/error.rs +++ b/crates/utils/src/error.rs @@ -142,7 +142,7 @@ pub enum LemmyErrorType { InvalidQuery, ObjectNotLocal, PostIsLocked, - PersonIsBannedFromSite, + PersonIsBannedFromSite(String), InvalidVoteValue, PageDoesNotSpecifyCreator, PageDoesNotSpecifyGroup,