From 497bac8a837a8f55c8f90de2c7e67d688abf79bb Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 23 May 2020 10:26:28 +0200 Subject: [PATCH] Check for tags before creation date --- cleantoots/commands/clean.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cleantoots/commands/clean.py b/cleantoots/commands/clean.py index 2055f32..d0a6079 100644 --- a/cleantoots/commands/clean.py +++ b/cleantoots/commands/clean.py @@ -166,11 +166,11 @@ def _toot_protection_reason(toot: dict, section) -> Optional[str]: ) if id_ in protected_toots or original_id in protected_toots: return "{} or {} is a protected id".format(id_, original_id) - if created_at >= time_limit: - return "creation time {} is later than limit {}".format(created_at, time_limit) for tag in toot.get("tags", []): tag_name = tag.get("name").lower() if tag_name and tag_name in protected_tags: return "{} is a protected tag".format(tag_name) + if created_at >= time_limit: + return "creation time {} is later than limit {}".format(created_at, time_limit) return None