Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Check IP address format and convert to string if needed #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ivory.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ def handle_pending_account(self, account: dict):
Handle a single pending account.
"""
self._logger.info("handling pending user %s", account['username'])

# The Mastodon API changed the return value for IP addresses from
# a string to a dict in 3.5
# if self._api.verify_minimum_version("3.5.0"):
if not isinstance(account['ip'], str):
new_ip = account['ip']['ip']
del account['ip']
account['ip'] = new_ip

(punishment, rules_broken) = self.pending_account_judge.make_judgement(account)
if rules_broken:
self._logger.info("pending account breaks these rules: %s", rules_broken)
Expand Down