Infraction scheduler raises exception when marking infraction as "permanent" during edit #751
Labels
a: moderation
Related to community moderation functionality: (moderation, defcon, verification)
p: 2 - normal
Normal Priority
t: bug
Something isn't working
When an existing temporary infraction is turned into a permanent infraction using the
!infraction edit
functionality, we ask the infraction scheduler to schedule a new task withinfraction["expires_at"] = None
. However, the scheduler expects to be called only for infractions that have a datetime string mapped to the"expires_at"
key. This means that the scheduler will try to parse thatNone
value withdateutil.parse.isoparse
, which results in an exception:I think the wisest course of action is tackle this at the level of the infraction edit method, not in the scheduler itself. We should just not try to schedule a new task when we've marked it as permanent. That means this part need to get an additional check:
bot/bot/cogs/moderation/management.py
Lines 131 to 134 in 95ae05c
Important: We should still cancel the existing scheduled task (which we currently do, it happens before the exception), so skipping this
if
block entirely will break the infraction edit in a more severe way: Cancelling the task is essential to guarantee that we don't accidentally "pardon" a now permanent infraction.The text was updated successfully, but these errors were encountered: