Fix broken email threading
The email threading support introduced in GitLab CE 6.9 is broken on several popular email clients (including Mail.app and Airmail on Mac OS X).
This MR makes the following changes to improve email threading compatibility:
- Subject of answers to an existing thread begins with
Re:
(required by Mail.app) - The recipient of every email in a thread is stable (required by Mail.app ; otherwise it groups emails by sender)
- Send a ‘In-Reply-To’ header along the ‘References’ header (for compatibility with the spec)
In order to do this, these commits:
- Change the
To:
field tonamespace/project
; the actual receiver is now in theCc:
field. - Introduce the
mail_new_thread
andmail_answer_thread
methods ; they format the message correctly for threading, and can generate theMessage-ID
automatically from a model instance. - Refactor the tests to shared behaviors for email threading.
We've been using these patches at @capitainetrain for a few months now ; I just ported them to work nicely with the recent threading commits.