From cace7645f1850d589fe44233d37c025b9db54a0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 23 Jun 2023 16:20:17 +0200 Subject: [PATCH] Continued: - changed 'suspend' back to 'suspended', there is 'silenced', 'quarantined' - still 'reject' is around ... --- fba/commands.py | 3 +++ fba/models/blocks.py | 8 ++++---- fba/networks/misskey.py | 2 +- fba/networks/pleroma.py | 12 ++++++------ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index 6a77376..3599e34 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -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']) diff --git a/fba/models/blocks.py b/fba/models/blocks.py index 67f36d3..d568d5b 100644 --- a/fba/models/blocks.py +++ b/fba/models/blocks.py @@ -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: diff --git a/fba/networks/misskey.py b/fba/networks/misskey.py index 7b94f75..1320d06 100644 --- a/fba/networks/misskey.py +++ b/fba/networks/misskey.py @@ -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) diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index c616cfd..0680fa4 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -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" -- 2.39.5