]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 15 Aug 2024 19:35:57 +0000 (21:35 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 15 Aug 2024 20:56:27 +0000 (22:56 +0200)
- let also process.block() abort when an unwanted block_level is provided
- alias also "reject" to "rejected"

fba/helpers/processing.py
fba/models/blocks.py

index 04954d2beffd644c5f4f3f21f778666c4a10d66d..464eded9175e04b32922b41cdcd9bc388612b51c 100644 (file)
@@ -97,6 +97,8 @@ def block(blocker: str, blocked: str, reason: str, block_level: str) -> bool:
         raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
     elif block_level == "":
         raise ValueError("Parameter block_level is empty")
+    elif block_level in ["reject", "suspend", "accept", "silence", "nsfw", "quarantined_instances"]:
+        raise ValueError(f"Parameter block_level='{block_level}' is not supported")
     elif blacklist.is_blacklisted(blocker):
         raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked")
     elif blacklist.is_blacklisted(blocked):
index c27bad3b0a01501960db42433fc7699bea6b8ee3..1ebe3eae1bc9fd8cbed0cc4b2e9f35baf1a81a84 100644 (file)
@@ -263,6 +263,9 @@ def alias_block_level(block_level: str) -> str:
     elif block_level == "suspend":
         logger.debug("Block level 'suspend' has been changed to 'suspended'")
         block_level = "suspended"
+    elif block_level == "reject":
+        logger.debug("Block level 'reject' has been changed to 'rejected'")
+        block_level = "rejected"
     elif block_level == "nsfw":
         logger.debug("Block level 'nsfw' has been changed to 'media_nsfw'")
         block_level = "media_nsfw"