Repository navigation
fix(admin): link the member for ban and member-note activities - #3043
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 neitherBannorMemberNotehas an admin show route (bans are a write-only resource nested under members; member notes only have a create route), so rendering raisesundefined method 'admin_ban_path'.Change
activity_subjectmapsBanandMemberNotetrackables to their member, so the log links toadmin_member_pathinstead of a route that does not exist.Review notes
nil) also stops the crash but loses the "for whom" context in the log line.Failure detail
The activity log links subjects with
link_to(label, [:admin, subject]). For aBantrackable that resolves toadmin_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 byowner) is affected.MemberNotehas the same shape and would fail identically.