Skip to content

Fix case contact restore after policy org scoping - #7273

Merged
compwron merged 1 commit into
mainfrom
fix/case-contact-restore-authorize
Oct 30, 2026
Merged

compwron merged 1 commit into
mainfrom
fix/case-contact-restore-authorize

Conversation

@compwron

Copy link
Copy Markdown
Collaborator

main has 3 rspec failures (spec/requests/case_contacts_spec.rb restore examples) since 9fad489.

CaseContactsController#restore called authorize CasaAdmin with the class. CasaAdminPolicy#restore? now checks that the record is in the user's org, so a class has no casa_org and the call raises NoMethodError. 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.rb fails 3 of 18 without this change and passes 18 of 18 with it.

🤖 Generated with Claude Code

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>
@github-actions github-actions Bot added the ruby Touches Ruby code label Oct 30, 2026
@compwron
compwron merged commit 934f95b into main Oct 30, 2026
12 checks passed
@compwron
compwron deleted the fix/case-contact-restore-authorize branch October 30, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Touches Ruby code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant