Skip to content

fix: use outerjoin in restricted filters to include open items without participants#104

Open
devin-ai-integration[bot] wants to merge 1 commit into
eval-bug-1from
devin/1781291233-fix-restricted-filters
Open

fix: use outerjoin in restricted filters to include open items without participants#104
devin-ai-integration[bot] wants to merge 1 commit into
eval-bug-1from
devin/1781291233-fix-restricted-filters

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

restricted_incident_filter and restricted_case_filter used query.join(Participant, ...) (INNER JOIN), which dropped all incidents/cases that had zero participants—including open-visibility ones that should always be visible to members.

Fix: joinouterjoin so the or_(visibility == open, email == current_user) filter works correctly against NULL participant rows:

# Before
query.join(Participant, Incident.id == Participant.incident_id)
    .join(IndividualContact)

# After
query.outerjoin(Participant, Incident.id == Participant.incident_id)
    .outerjoin(IndividualContact)

Same change applied to both restricted_incident_filter and restricted_case_filter.

Link to Devin session: https://app.devin.ai/sessions/9ecbd6ca651b4e779d528a025a652009

…t participants

The restricted_incident_filter and restricted_case_filter functions used
INNER JOIN with Participant, which excluded open incidents/cases that had
no participants. Changed to outerjoin (LEFT JOIN) so that open items are
correctly included regardless of participant presence.

Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

0 participants