Skip to content

Make email handlers clearer and ensure they are globally unique

Reposting from the discussion at https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13817#note_38672505.

We have at the moment as the key part of the email (the part in incoming+%{key}@gitlab.com):

  • path/to/project - Service Desk (EE only)
  • sent_notification_key+unsubscribe - unsubscribe
  • sent_notification_key - reply to thread
  • path/to/project+merge-request+user_email_token - create merge request
  • path/to/project+user_email_token - create issue

sent_notification_key and user_email_token cannot contain slashes, and path/to/project must, which is why this works.

We should:

  1. Ensure that these don't clash in future with a spec.
  2. Perhaps move out the regexes to the Handler class, and define the matching there, while keeping the remaining logic in individual handlers.

/cc @godfat