Improve email threading
This is a follow-up to !112 : it improves email threading, without changing the receiver of the emails.
* Subject of answers to an existing thread begins with `Re: ` (required by Mail.app)
* Send a 'In-Reply-To' header along the 'References' header
* send a ‘In-Reply-To’ header along the ‘References’ header
* subject of answers to an existing thread begins with ‘Re: ’
This fixes threading with at least Mail.app and Airmail.
This fixes email threading in Mail.app, that doesn't like when a thread
doesn't have stable recipients.
For instance, here is a possible sender-recipient combinations before:
From: A
To: Me
New issue
From: B
To: Me
Reply on new issue
From: A
To: Me
Another reply
Mail.app doesn't see B as a participant to the original email thread,
and decides to break the thread: it will group all messages from A
together, and separately all messages from B.
This commit makes the thread look like this:
From: A
To: gitlab/project
Cc: Me
New issue
From: B
To: gitlab/project
Cc: Me
Reply on new issue
From: A
To: gitlab/project
Cc: Me
Another reply
Mail.app sees a common recipient, and group the thread correctly.
The 'author_id_of_changes' attribute is not persisted in the database.
As we retrieve the merge request from the DB just before sending the
email, this attribute was always nil.
Also there was no tests for the merge notification code - tests have
been added.
Fix#6605
Every email has a different way of showing a link to the discussion on
the website. We don't need this anymore, as we now have a standard
"View in GitLab" link in the footer of every email.
When an email notification concerns a specific object (issue, note,
merge request, etc.), add a link to the footer of the email that opens
the item's page in a web browser.
Rationale:
* The link is predictable: always the same text, always at the same
location, like any reliable tool.
* It allows to remove the inline-title in many emails, and leave only
the actual content of the message.
This changes the email "From" field from "gitlab@example.com" to either:
* "John Doe <gitlab@example.com>" if the author of the action is known,
* "GitLab <gitlab@example.com>" otherwise.
Rationale: this allow mails to appear as if they were sent by the
author. It appears in the mailbox more like a real discussion between
the sender and the receiver ("John sent: we should refactor this") and
less like a robot notifying about something.
This changes the email subjects for issues and merge request
notifications from:
Team / Project | Note for issue #1234
to:
Team / Project | Saving issue doesn't work sometimes (#1234)
Rationale:
* Scan the subject of the email notification more easily when catching
up with a lot of notifications. Instead of having to open the email to
get the title of the issue or merge request, one can simply read the
subject of the email.
* Group messages by subject: email clients will group emails in threads
if they have the same subject.
For instance, the email "Subject" field changes from:
Mattt / Ground Control | Saving issue doesn't work sometimes (#1234)
to:
Ground Control | Saving issue doesn't work sometimes (#1234)
Rationale:
* Most people are receiving email notifications about a single fork:
the project activity, issues and merge requests are happening either
in a root repository or in a fork, but less often in several forks.
* It removes noise from the email subject. The namespace of the project
can still be read in the email body.
* For Entreprise users that have a single namespace "MyEntreprise",
having this repeated in every email subject is very noisy.
This changes email subjects from:
GitLab | Team / Project | Note for issue #1234
to:
Team / Project | Note for issue #1234
Rationale:
* Emails should be as meaningful as possible, and emphasize content over
chrome. The "GitLab" name is more chrome than content.
* Users can tell an email coming from GitLab by the sender or the header
in the email content.
* An organization that works mainly with GitLab knows that
every SVC email comes from GitLab. For these organizations, having
"GitLab" in front of every email is just noise hiding the meaningful
information.
Emails are used to associate commits with users. The emails
are not verified and don't have to be valid email addresses. They
are assigned on a first come, first serve basis.
Notifications are sent when an email is added.
A test was broken if running on a non-standard port.
Made checking for (non-)standard port more robust.
Changed gitlab_on_non_standard_port to gitlab_on_standard_port (less negative).
After this change project name appears in the top part of email when you
open/close/accept merge request.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
There was some funny syntax in merge request email templates. There was a ! before
the merge request number when there probably should be a #. This may be some carry over
from markdown but should not be in email templates. There were also some capitalization
discrepancies among the subject lines. For those OCD people out there I standardized the
capitalization. :)
-Some changes around calling origional methods for !for_fork? merge requests. Other changes to follow
Change-Id: I009c716ce2475b9efa3fd07aee9215fca7a1c150