Missing `X-GitLab-NotificationReason` header in email notifications

Summary

The header X-GitLab-NotificationReason is missing in email notifications. It seems to be only missing in comments according to @smcgivern in our Slack conversation.

Steps to reproduce

  • Create an account on GitLab.com
  • Enable notifications
  • Ask someone to comment on an issue or an MR and ping you
  • Check out your emails

Example Project

  • GitLab-CE

What is the current bug behavior?

Email is received but doesn't contain the header mentioned in this documentation page: https://docs.gitlab.com/ee/workflow/notifications.html#x-gitlab-notificationreason. Some other notifications, like "Epic was closed by [user]" have the header, but empty:

X-GitLab-NotificationReason: 

What is the expected correct behavior?

Comments notifications should have the X-GitLab-NotificationReason header, set to one of the values supported and described in https://docs.gitlab.com/ee/workflow/notifications.html#x-gitlab-notificationreason (as of today, own_activity, assigned or mentioned).

Relevant logs and/or screenshots

screenshot_2019-06-11_20.38.33_360

Output of checks

This bug happens on GitLab.com

refs https://gitlab.com/gitlab-org/gitlab-ce/issues/41532

/cc @smcgivern