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 to `namespace/project` ; the actual receiver is now in the `Cc:` field.
* Introduce the `mail_new_thread` and `mail_answer_thread` methods ; they format the message correctly for threading, and can generate the `Message-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.
* 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.
http://localhost:3000/gitlabhq/gitlab-ci/merge_requests/1/diffs#note_316
scroll in such links doesn't work. It happens because on page there are 2 elements with id="note_316" in changes and discussion.
Browser takes first for scroll.
This solution works because changes loads without diffs so tag with id="note_316" just one.
Diffs loads with discussions, but in this case diff tag would be first.
It is dirty but working solution.
Project commit count for default branch
Currently, the commit count displayed on a project's home page shows the total number of commits on the master branch. This can lead to situations in which a project may have no commits reported or very few if the project workflow does not involve the use of a branch named "master". Since number of commits can be an indicator of project health, showing 0 commits could make it harder to encourage adoption of a project.
This MR alters the repository model's `commit_count` method to return the count for the default branch instead of master.
See issue #299
So now when you type site/:username it redirects you to users page.
And if you type site/:groupname it redirects you to group page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Faster diff rendering
1. Dont render link in separate template but use helper instead
2. Don't build new object but just reuse variables
New note for diff is rendered per each diff line. Such simple improvements gives us 20..100% better performance depends on diff size