diff options
author | 2020-02-27 08:39:50 -0800 | |
---|---|---|
committer | 2020-02-27 08:39:50 -0800 | |
commit | 671052ca7862fd75c38e5f5162ce0dc4ded8531b (patch) | |
tree | 1b43815dd26337a799da8763d349e45fe9fd504a | |
parent | Merge pull request #785 from Numerlor/channel_constants_check (diff) |
Moderation: fix task cancellation for permanent infraction when editing
A task should not be cancelled if an infraction is permanent because
tasks don't exist for permanent infractions.
Fixes BOT-1V
-rw-r--r-- | bot/cogs/moderation/management.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/cogs/moderation/management.py b/bot/cogs/moderation/management.py index f2964cd78..f74089056 100644 --- a/bot/cogs/moderation/management.py +++ b/bot/cogs/moderation/management.py @@ -129,7 +129,9 @@ class ModManagement(commands.Cog): # Re-schedule infraction if the expiration has been updated if 'expires_at' in request_data: - self.infractions_cog.cancel_task(new_infraction['id']) + # A scheduled task should only exist if the old infraction wasn't permanent + if old_infraction['expires_at']: + self.infractions_cog.cancel_task(new_infraction['id']) # If the infraction was not marked as permanent, schedule a new expiration task if request_data['expires_at']: |