Repository navigation
Fix case contact restore after policy org scoping - #7273
Merged
Merged
Conversation
CaseContactsController#restore called `authorize CasaAdmin` with the class, which now hits the org-aware CasaAdminPolicy#restore? and raises. The next line already authorizes the case contact itself (CaseContactPolicy#restore? requires an admin in the same org), so the class-level call is redundant. Fixes the 3 rspec failures on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
mainhas 3 rspec failures (spec/requests/case_contacts_spec.rbrestore examples) since 9fad489.CaseContactsController#restorecalledauthorize CasaAdminwith the class.CasaAdminPolicy#restore?now checks that the record is in the user's org, so a class has nocasa_organd the call raisesNoMethodError. The next line already authorizes the actual case contact (CaseContactPolicy#restore?→is_admin_same_org?), so the class-level call was redundant. This PR removes it.I checked the other class-level
authorize/policy(...)calls in controllers and views. None of them hit a method that changed in 9fad489.Tests:
spec/requests/case_contacts_spec.rbfails 3 of 18 without this change and passes 18 of 18 with it.🤖 Generated with Claude Code