Optional Merge Request notifications for approvers
Problem to Solve
Users who are listed as approvers on a merge request are not notified of new merge request requiring their approval.
Additional Details
In #616 (closed), users with approver and other roles to play in the MR were no longer automatically made participants which reduced notifications to only MRs where they were an active participant.
Proposal
An optional project level configuration should be created to enable a one-time notification (Email + To-Do) on MR creation for eligible approvers. This will provide a notification that an MR needs to be addressed, but will not add those members as participants for subsequent notifications on the MR (unless they become a participant).
IMPORTANT NOTE: This issue is labeled ~"Accepting merge requests" and is NOT something that GitLab will work towards as it does not align with our vision for Reviewers and the Review process. We will accept a community contribution for the outlined proposal. More details in: #12855 (comment 489881317)
Original Description
Summary
When creating a merge request (from feature branch to dev branch), notification emails are not sent to approvers
Steps to reproduce
Repo setup: accept FF merges only
Notification setting of approvers for repo: Global (Participate)
- Create a dev branch from master
- Create a feature branch from dev branch
- Push commits to feature branch
- Create merge request from feature branch, change target branch to dev branch
- Select author as assignee
- Set No. of approvers to 1, select 2 approvers.
- Submit the merge request
Example Project
N/A
What is the current bug behavior?
Notification emails are not sent to approvers.
What is the expected correct behavior?
Notification of the new merge request is sent to approvers.
Relevant logs and/or screenshots
N/A
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
N/A
Results of GitLab application Check
N/A
Possible fixes
Implementation Plan
We will probably need to do something like:
- Add a new column to the
project_settings
table using a database migration: https://docs.gitlab.com/ee/development/migration_style_guide.html#create-a-regular-schema-migration - Build the functionality to send the notifications (probably using https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/notification_service.rb) and create the todos (probably using https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/todo_service.rb)
- Allow the field to be set/toggled (probably via the merge request approval settings API https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/api/merge_request_approval_settings.rb)
- Add the field to the UI (https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/assets/javascripts/approvals/components/approval_settings.vue)
We probably do NOT need to build this behind a feature flag because it is behind a setting.