]> Untitled Git - lemmy.git/commitdiff
Add person name to PersonIsBannedFromSite error (#3786) (#3855)
authorFreakazoid182 <fvanzee@gmail.com>
Wed, 16 Aug 2023 09:36:58 +0000 (11:36 +0200)
committerGitHub <noreply@github.com>
Wed, 16 Aug 2023 09:36:58 +0000 (11:36 +0200)
* 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 <freek.van.zee@mediamonks.com>
crates/apub/src/activities/mod.rs
crates/apub/src/objects/private_message.rs
crates/utils/src/error.rs

index bc8379f111b9b070420d6f951f74592cf883265c..ad04e861f7ffd4217496f87d1978101b5a706f7b 100644 (file)
@@ -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;
index a51cfe6b77c2cad5008a062cc1a424a85ec968ae..9a92b0b5197f0bad2af93bef2e0c4b7bb8e30b0a 100644 (file)
@@ -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(())
   }
index 9ddd3b293ebc6173ed64b8d9ba8873698d2989d2..0dd9ba6cb421b4e91a22632ebf4479d110fbecb4 100644 (file)
@@ -142,7 +142,7 @@ pub enum LemmyErrorType {
   InvalidQuery,
   ObjectNotLocal,
   PostIsLocked,
-  PersonIsBannedFromSite,
+  PersonIsBannedFromSite(String),
   InvalidVoteValue,
   PageDoesNotSpecifyCreator,
   PageDoesNotSpecifyGroup,