Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Not send notifications when it should never notify assignment #620

Merged

Conversation

Grubba27
Copy link
Contributor

@Grubba27 Grubba27 commented Dec 12, 2024

This pr adds a SilencedAssignment table, which gets new records when Assigner#assign is called with should_notify as false, which keeps track of assignments that should not have notifications for


  • Added silenced_assignments table and migration to store silenced assignments
  • Added tests for silenced assignments

- Added silenced_assignments table and migration to store silenced assignments
- Added tests for silenced assignments
@@ -4,6 +4,7 @@ module Jobs
class AssignNotification < ::Jobs::Base
def execute(args)
raise Discourse::InvalidParameters.new(:assignment_id) if args[:assignment_id].nil?
return if SilencedAssignment.exists?(assignment_id: args[:assignment_id])
Copy link
Contributor

Choose a reason for hiding this comment

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

The most minor style thing -- empty line under early return (guard clauses) is kinda nice.

Copy link
Contributor

@markvanlan markvanlan left a comment

Choose a reason for hiding this comment

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

In PR / commit description can you write a bit more about the conditions in which this was helpful? It's not obvious how this notification is triggered, especially b/c in lib/assigner we see a should_notify variable so you'd expect this to already be taken care of.

Looks great! I would normally say we should clean these up.. Which I guess in the assign notification job you could find, delete, and skip rather than find and skip 🤷 . I'm not too worried about this table ballooning though hehe. And you have an index for lookup.

@Grubba27 Grubba27 merged commit 0f4a1fc into main Dec 12, 2024
6 checks passed
@Grubba27 Grubba27 deleted the fix/notifications-when-it-should-never-notify-assignment branch December 12, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants