Skip to content
Permalink
Branch: master
Commits on Feb 14, 2020
  1. Stop scheduling expiration of permanent infractions on edit

    SebastiaanZ committed Feb 14, 2020
    #751
    
    The infraction edit command defined in `bot.cogs.moderation.management` contained a bug causing it to attempt to schedule an expiration task when turning a temporary infraction into a permanent infraction. Since the "expires_at" field of a permanent infractions is `None`, this caused an exception to occur in the scheduler:
    
    Traceback (most recent call last):
      File "/bot/bot/cogs/moderation/scheduler.py", line 415, in _scheduled_task
        expiry = dateutil.parser.isoparse(infraction["expires_at"]).replace(tzinfo=None)
      File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 37, in func
        return f(self, str_in, *args, **kwargs)
      File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 134, in isoparse
        components, pos = self._parse_isodate(dt_str)
      File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 208, in _parse_isodate
        return self._parse_isodate_common(dt_str)
      File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 213, in _parse_isodate_common
        len_str = len(dt_str)
    TypeError: object of type 'NoneType' has no len()
    
    I have solved this by adding a check that makes sure we only schedule an expiration task when the `"expires_at"` field has a truthy value (which all valid datetime strings are) using `if request_data['expires_at']`.
    
    IMPORTANT NOTE: While it's tempting to just skip the entire scheduling block for permanent infractions, it's essential to unschedule existing expiration tasks for this infraction as we're changing a temporary infraction to a permanent infraction.
    
    This commit closes #751
Commits on Feb 12, 2020
  1. Merge pull request #747 from mosguinz/pagniation-fix

    SebastiaanZ committed Feb 12, 2020
    Fix pagniation module for "last page" reaction
You can’t perform that action at this time.