Allow commenting on individual commits inside an MR
Design
- In the commits tab, it will still only show the commits for the current version. If you click on a commit in the commits tab, then it will navigate you to the changes tab that is with respect with a specific commit (instead of merge request version). You can resolve discussions as normal.
- From the changes tab view of a particular commit, you can click and go to the a special commit view that is associated with a merge request. Commenting there is with respect to that commit and merge request.
- The discussion tab will have all comments on all commits, even for all old versions and newest version of the merge request.
- The discussion tab will show all commits as usual. What is changed is that when you click on a commit from this tab, you will be navigated to that special commit view of the changes tab.
Previous description
Effectively replaces https://gitlab.com/gitlab-org/gitlab-ce/issues/30238, https://gitlab.com/gitlab-org/gitlab-ee/issues/1166 and https://gitlab.com/gitlab-org/gitlab-ce/issues/24323.
An evolution of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10388.
When reviewing the Nth iteration of a merge request, you often only want to review the changes between the last version of the MR and the current one, so you don't see code you've already reviewed, and so you can verify that your feedback was actually addressed.
With https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10388 in GitLab 9.2, it is now possible to add diff comments directly on a specific (older) version of the merge request, or on the comparison between two different versions, like the previous one and the current one. This means that if you follow the "Compare with previous version" link in a "User added N commits" system note like this one, you can leave comments there just like you can on the latest version of the MR.
Besides reviewing the differences between two versions, it would be nice if we could review individual commits of large MRs one by one, leaving comments on them that will show up in the MR just like comments on versions do. It is already possible to browse to an individual commit and comment on it, that will also show up on the MR discussion tab, but these comments will be directly linked to the commit, not the MR, which means that they will disappear from the MR page if that specific commit no longer exists inside the MR (for example if it is ever overwritten using a force push), and that these comments will not be resolvable, since only MR discussions have the context of the MR that allows them to be resolved.
Now that we allow commenting on specific comparisons within an MR, we're only a small step away from allowing commenting on specific commits within that MR, in such a way that the comments are still linked specifically to the MR rather than being comments on the commit itself.
To accomplish this, we should:
- actually allow the creation of such comments on individual commits in the context of the MR,
- change the links in the MR's "Commits" tab to link to this new page,
- do the same for the "User added N commits" system note, and
- we should also update the "Changes between [version A] and [version B] selector on the "Changes" tab to allow not only selection of versions, but also of individual commits inside those versions.
1, 2 and 3 require pretty much exclusively backend work, but for 4 we need some help from UX and Frontend.
/cc @victorwu @smcgivern