]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 22 Jun 2023 19:19:00 +0000 (21:19 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 22 Jun 2023 19:19:00 +0000 (21:19 +0200)
- don't re-check/tidy-up block reason and domain if already done

fba/networks/mastodon.py

index 7271847128df00ce3707b92f70f29ce4a361f49a..47f19c07e098d31ac3d659c50671d6c025e9c2e9 100644 (file)
@@ -190,7 +190,7 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                     logger.debug(f"block[]='{type(block)}' is of type 'dict' - SKIPPED!")
                     continue
 
-                reason = tidyup.reason(block["comment"]) if "comment" in block else None
+                reason = tidyup.reason(block["comment"]) if "comment" in block and block['comment'] is not None and block['comment'] != "" else None
 
                 logger.debug("Appending blocker='%s',blocked='%s',reason='%s',block_level='%s'", domain, block['domain'], reason, block['severity'])
                 blocklist.append({
@@ -203,13 +203,6 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
         else:
             logger.debug("domain='%s' has no block list")
 
-        logger.info("Checking %d entries from domain='%s' ...", len(blocklist), domain)
-        for block in blocklist:
-            logger.debug("blocker='%s',blocked='%s',reason='%s',block_level='%s'", block['blocker'], block['blocked'], block['reason'], block['block_level'])
-            block['blocked'] = tidyup.domain(block['blocked'])
-            block['reason']  = tidyup.reason(block['reason'])
-            logger.debug("blocked='%s',reason='%s' - AFTER!", block['blocked'], block['reason'])
-
     except network.exceptions as exception:
         logger.warning("domain='%s',exception[%s]='%s'", domain, type(exception), str(exception))
         instances.set_last_error(domain, exception)