Skip to content

fix(admin): link the member for ban and member-note activities - #3043

Merged
mroderick merged 1 commit into
masterfrom
fix/admin-ban-activity-subject
Oct 16, 2026
Merged

mroderick merged 1 commit into
masterfrom
fix/admin-ban-activity-subject

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Problem

Admin member profiles return 500 when the activity log contains a ban or member-note entry. The view builds a polymorphic [:admin, trackable] link, and neither Ban nor MemberNote has an admin show route (bans are a write-only resource nested under members; member notes only have a create route), so rendering raises undefined method 'admin_ban_path'.

Change

  • activity_subject maps Ban and MemberNote trackables to their member, so the log links to admin_member_path instead of a route that does not exist.
  • Regression specs cover both the helper mapping and the rendered profile page.

Review notes

  • Look first at the mapping choice: link the banned/noted member rather than dropping the link. Dropping it (returning nil) also stops the crash but loses the "for whom" context in the log line.
  • Deliberately not done: no show routes added for bans or notes (no such pages exist), and no generic route-existence guard for trackable types added in the future.
Failure detail

The activity log links subjects with link_to(label, [:admin, subject]). For a Ban trackable that resolves to admin_ban_path, which is undefined; the template error propagates as a 500 for the whole profile page. Any member with a ban activity they performed (the log lists activities by owner) is affected. MemberNote has the same shape and would fail identically.

`activity_subject` passed Ban and MemberNote trackables through unchanged,
so the activity log built `[:admin, trackable]` links for them. Neither has
an admin show route: bans are a write-only resource nested under members
(index/new/create) and member notes only have a create route. Rendering an
admin member profile with such an activity raised `undefined method
admin_ban_path` and returned 500.

Both record types describe an action about a member, so link that member.

Regression specs cover the helper mapping and the rendered profile page.
@mroderick
mroderick marked this pull request as ready for review October 16, 2026 05:09
@mroderick
mroderick merged commit 98b12b6 into master Oct 16, 2026
18 of 19 checks passed
@mroderick
mroderick deleted the fix/admin-ban-activity-subject branch October 16, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant