Skip to content

Conversation

@di
Copy link
Member

@di di commented Dec 22, 2025

No description provided.

@di di requested a review from a team as a code owner December 22, 2025 19:16
@di di force-pushed the feat/ban-unban-ip-address branch from ce54162 to 9e10473 Compare December 22, 2025 19:23
@miketheman miketheman added the admin Features needed for the Admin UI (people running the site) label Dec 22, 2025
Copy link
Member

@miketheman miketheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - a couple of non-blocking inline comments

assert ip_address.ban_date is not None


class TestUnbanIpAddress:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: worth adding a test case and handling for unbanning an already-unbanned entry, or are we fine with doing the unban operation regardless of current state?


<dt class="col-sm-4">Ban Reason:</dt>
<dd class="col-sm-8">{{ ip_address.ban_reason.value }}</dd>
<dd class="col-sm-8">{{ ip_address.ban_reason.value if ip_address.ban_reason is not none else 'None' }}</dd>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was reading more about Jinja2 filters recently, and I think this could also be expressed as:

Suggested change
<dd class="col-sm-8">{{ ip_address.ban_reason.value if ip_address.ban_reason is not none else 'None' }}</dd>
<dd class="col-sm-8">{{ ip_address.ban_reason.value | default('None') }}</dd>

but that means that the .value call would have failed a lookup on None.

Maybe we should instead change the BanReason from an Enum to a StrEnum, like we do in other places, and thus don't need to refer to it by .value?

A larger refactor, but probably worthwhile to consider as a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admin Features needed for the Admin UI (people running the site)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants