[go: up one dir, main page]

Skip to content

Email notifications: X-GitLab-NotificationReason not set to review_requested on MR creation

Summary

When you are assigned as a reviewer in a merge request, the X-GitLab-NotificationReason header in the notification email for the assignment event is set to review_requested, making it possible to filter for these notifications. This header is not set for Merge Request creation notifications when the reviewer list is configured on creation. In contrast, when a Merge Request is created with a preconfigured assignee, the notification email correctly contains the header X-GitLab-NotificationReason: assigned.

Steps to reproduce

  1. Create a merge request with another account as a merge request reviewer
  2. Observe that the notification email the other account gets does not contain X-GitLab-NotificationReason: review_requested
  3. Remove the other account from the reviewer list
  4. Add the other account to the reviewer list
  5. Observe that the notification email the other account gets now does contain X-GitLab-NotificationReason: review_requested

Note: It seems impossible to reproduce this with a single account because then gitlab either sends no emails at all or overrides X-GitLab-NotificationReason with own_activity, depending on your notification settings.

What is the current bug behavior?

New merge requests with a preconfigured list of reviewers trigger notification emails without X-GitLab-NotificationReason set to review_requested.

What is the expected correct behavior?

New merge requests with a preconfigured list of reviewers should set the X-GitLab-NotificationReason correctly to review_requested, similar to how it works with merge request assignees

Possible fixes

This line in app/services/notification_recipients/builder/default.rb is the only difference I can find between the behaviour of notifications regarding assignees and reviewers, so this might be the problem.