[6199] BUG: case contacts showing for unassigned volunteers#6278
Merged
[6199] BUG: case contacts showing for unassigned volunteers#6278
Conversation
compwron
reviewed
Mar 29, 2025
|
|
||
| @pagy, @filtered_case_contacts = pagy(@filterrific.find) | ||
| case_contacts = CaseContact.case_hash_from_cases(@filtered_case_contacts) | ||
| case_contacts = case_contacts.select { |k, _v| current_user.casa_cases.pluck(:id).include?(k) } if current_user.volunteer? |
Collaborator
There was a problem hiding this comment.
Ideally this type of logic would be in a pundit policy file but we are very spotty with that in general, so dont worry about it in this pr
Collaborator
|
Rebasing should fix most of the failures - I will try it and merge if so. |
9a87510 to
b790b77
Compare
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.



What github issue is this PR for, if any?
Resolves #6199
What changed, and why?
Added an filtering step in the
case_contactscontroller for the index if a volunteer is logged in to only pass on case contacts for assigned cases to the view.Volunteers should not be seeing case contacts for cases no longer assigned to them.
How is this tested? (please write rspec and jest tests!) 💖💪
A test was added where a volunteer is logged in and is the creator of two case contacts, one for an assigned case (with a duration of 180 minutes) and one for a case that is not assigned to them (with factory default duration of 60 min). The test checks the page for the presence of "60 minutes" and omission of "3 hours".
Screenshots please :)
URL when logged in as a volunteer: http://127.0.0.1:3000/case_contacts
Before:

Case contacts included without a Case No heading (meaning it's been unassigned.)
After:

Orphaned case contacts no longer display below assigned case case contacts.
Feelings gif (optional)