Fix group level work item notifications
What does this MR do and why?
Now we have issues that are associated directly to a group. Before, an issue would always belong to a project, so we need to make some changes for the mailers to handle both scenarios. Now issues always belong to a namespace (Group
or ProjectNamespace
, both on the namespaces table)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Enable the
namespace_level_work_items
FF in the rails consoleFeature.enable(:namespace_level_work_items)
- Go to work items list at the group level http://localhost:3000/groups/flightjs/-/work_items
- Create a new epic
- We can test the mailers in the console as there are many to trigger. Then we can see the sent emails in http://localhost:3000/rails/letter_opener
In the rails console try the following
u = User.first
i = Issue.where(project_id: nil).last
Notify.new_issue_email(u.id, i.id).deliver
i.update(due_date: 1.day.ago)
Notify.issue_due_email(u.id, i.id).deliver
Notify.reassigned_issue_email(u.id, i.id, [u.id], u.id).deliver
Notify.closed_issue_email(u.id, i.id, u.id).deliver
label = i.namespace.labels.first
Notify.relabeled_issue_email(u.id, i.id, [l.name], u.id).deliver
Notify.removed_milestone_issue_email(u.id, i.id, u.id).deliver
Notify.changed_milestone_issue_email(u.id, i.id, Milestone.last, u.id).deliver
Notify.issue_status_changed_email(u.id, i.id, 'closed', u.id).deliver
Related to #425016 (closed)
Edited by Mario Celi