Skip to content

Fix recipient handling in create_notification method#13548

Merged
mtesauro merged 4 commits intoDefectDojo:bugfixfrom
dorkdiaries9:patch-1
Oct 31, 2025
Merged

Fix recipient handling in create_notification method#13548
mtesauro merged 4 commits intoDefectDojo:bugfixfrom
dorkdiaries9:patch-1

Conversation

@dorkdiaries9
Copy link
Copy Markdown
Contributor

Summary

Adds a defensive check in create_notification() to skip processing when recipients is provided but empty.

Details

  • Prevents unnecessary calls to _process_recipients()
  • Adds debug log for traceability

Testing

Validated that:

  • Notifications continue working normally for valid recipient lists
  • Debug log appears and processing stops for empty lists

Type of Change

  • Bugfix (non-breaking change)

Copy link
Copy Markdown
Contributor

@Maffooch Maffooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please base your changes against the dev or bugfix branch

@dorkdiaries9 dorkdiaries9 changed the base branch from master to bugfix October 28, 2025 04:28
@dorkdiaries9 dorkdiaries9 requested a review from Maffooch October 28, 2025 04:29
@valentijnscholten valentijnscholten added this to the 2.52.0 milestone Oct 28, 2025
@valentijnscholten
Copy link
Copy Markdown
Member

valentijnscholten commented Oct 28, 2025

@dorkdiaries9 Thanks for the PR. Does it fix an actual bug or is it more defensive/optimization. I haven't looked at the code, but I wonder where this notification for 0 recipients is triggered.

@dorkdiaries9
Copy link
Copy Markdown
Contributor Author

Thanks for the PR. Does it fix an actual bug or is it more defensive/optimization. I haven't looked at the code, but I wonder where this notification for 0 recipients is triggered.

Thanks for reviewing!
This change prevents unnecessary notification processing when the recipients list is empty.
Earlier, the method continued execution even if recipients was an empty list, which could lead to redundant logs or unintended calls to _process_recipients.
So, this is a small bug fix to ensure that we only proceed when there are valid recipients.

Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@mtesauro mtesauro merged commit 1ba1122 into DefectDojo:bugfix Oct 31, 2025
149 checks passed
Maffooch pushed a commit to valentijnscholten/django-DefectDojo that referenced this pull request Feb 16, 2026
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.

5 participants