]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 23 Jun 2023 14:20:17 +0000 (16:20 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 23 Jun 2023 14:20:17 +0000 (16:20 +0200)
- changed 'suspend' back to 'suspended', there is 'silenced', 'quarantined'
- still 'reject' is around ...

fba/commands.py
fba/models/blocks.py
fba/networks/misskey.py
fba/networks/pleroma.py

index 6a773764c8ed88d55f8777403cbfc72ef5dc3952..3599e34f64f2026e6e14823fd8ec1be9c7c05dac 100644 (file)
@@ -274,6 +274,9 @@ def fetch_blocks(args: argparse.Namespace) -> int:
             if block['block_level'] == "silence":
                 logger.debug("Block level 'silence' has been changed to 'silenced'")
                 block['block_level'] = "silenced"
+            elif block['block_level'] == "suspend":
+                logger.debug("Block level 'suspend' has been changed to 'suspended'")
+                block['block_level'] = "suspended"
 
             if not blocks.is_instance_blocked(blocker, block['blocked'], block['block_level']):
                 logger.debug("Invoking blocks.add_instance(%s, %s, %s, %s)", blocker, block['blocked'], block['reason'], block['block_level'])
index 67f36d30e7e1d6c06224d016fd851598231053eb..d568d5b766d4457b9838041c499e9b7da19ef290 100644 (file)
@@ -47,7 +47,7 @@ def update_reason(reason: str, blocker: str, blocked: str, block_level: str):
         raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not 'str'")
     elif block_level == "":
         raise ValueError("Parameter 'block_level' is empty")
-    elif block_level in ["accept", "suspended", "silence"]:
+    elif block_level in ["accept", "suspend", "silence"]:
         raise ValueError(f"block_level='{block_level}' is not wanted.")
 
     logger.debug("Updating block reason='%s',blocker='%s',blocked='%s',block_level='%s'", reason, blocker, blocked, block_level)
@@ -81,7 +81,7 @@ def update_last_seen(blocker: str, blocked: str, block_level: str):
         raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not 'str'")
     elif block_level == "":
         raise ValueError("Parameter 'block_level' is empty")
-    elif block_level in ["accept", "suspended", "silence"]:
+    elif block_level in ["accept", "suspend", "silence"]:
         raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
 
     database.cursor.execute(
@@ -113,7 +113,7 @@ def is_instance_blocked(blocker: str, blocked: 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 ["accept", "suspended", "silence"]:
+    elif block_level in ["accept", "suspend", "silence"]:
         raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
 
     database.cursor.execute(
@@ -143,7 +143,7 @@ def add_instance(blocker: str, blocked: str, reason: str, block_level: str):
         raise Exception(f"blocker='{blocker}' is blacklisted but function invoked")
     elif blacklist.is_blacklisted(blocked):
         raise Exception(f"blocked='{blocked}' is blacklisted but function invoked")
-    elif block_level in ["accept", "suspended", "silence"]:
+    elif block_level in ["accept", "suspend", "silence"]:
         raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
 
     if reason is not None:
index 7b94f75279cd26be5e3ba6fea3d45f60823f7d05..1320d06f394b974a14a6e79cf8a37e7e82f78e40 100644 (file)
@@ -202,7 +202,7 @@ def fetch_blocks(domain: str) -> list:
                         "blocker"    : domain,
                         "blocked"    : tidyup.domain(instance["host"]),
                         "reason"     : None,
-                        "block_level": "suspend",
+                        "block_level": "suspended",
                     })
 
             logger.debug("count=%d", count)
index c616cfd3bfd1ae9d3fee68a55d20e9075aaafe4f..0680fa42b83626551afa3cda6440d38ad7dc47e4 100644 (file)
@@ -92,9 +92,9 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
             elif block_level == "accept":
                 logger.debug("domain='%s' skipping block_level='accept'", domain)
                 continue
-            elif block_level == "suspended":
-                logger.debug("domain='%s', mapping 'suspended' to 'suspend'", domain)
-                block_level = "suspend"
+            elif block_level == "suspend":
+                logger.debug("domain='%s', mapping 'suspend' to 'suspended'", domain)
+                block_level = "suspended"
             elif block_level == "silence":
                 logger.debug("domain='%s', mapping 'silence' to 'silenced'", domain)
                 block_level = "silenced"
@@ -244,9 +244,9 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
             elif block_level == "accept":
                 logger.debug("domain='%s' skipping block_level='accept'", domain)
                 continue
-            elif block_level == "suspended":
-                logger.debug("domain='%s', mapping 'suspended' to 'suspend'", domain)
-                block_level = "suspend"
+            elif block_level == "suspend":
+                logger.debug("domain='%s', mapping 'suspend' to 'suspended'", domain)
+                block_level = "suspended"
             elif block_level == "silence":
                 logger.debug("domain='%s', mapping 'silence' to 'silenced'", domain)
                 block_level = "silenced"