[go: up one dir, main page]

Skip to content

Add system note on new commit when a change is made on one of the lines in multi-line comments

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

After a multi-line comment is added to an MR diff, and a new commit is made on one of the selected lines, the system note on the new commit added does not appear in the comment.

The system note on the commit is only added when there is a code change to all lines of the multi-line comment.

Users have difficulty knowing if there are changes on the MR diff section that is showing up in the comment, unless they are told, review the Activity or check on the commits made.

Steps to reproduce

  1. Create a new project and initialize repository with a README.
  2. Make a change on 3 lines of code, commit to a new branch and create an MR.
  3. Make a comment on the line 1 of changed code.
  4. Make a multi-line comment on the line 2 and 3 of changed code.
  5. Make a new commit on the same branch on line 1 and line 2 of the changed code.

You should see the system note "XXX changed this line in version Y of the diff Z hours ago" within the single-line comment, but not within the multi-line comment.

Example Project

Multi-line comment: https://gitlab.com/gitlab-silver/kenneth-silver/zd377786/-/merge_requests/4
Single-line comment: https://gitlab.com/gitlab-silver/kenneth-silver/zd377786/-/merge_requests/7

What is the current behavior?

System note on new commit only appear in multi-line comments in a merge request diff when the code change is on all selected lines.

What is the expected behavior?

System note on new commit appear in multi-line comments in a merge request diff, when the change is on any of the selected lines.

Relevant logs and/or screenshots

image

Output of checks

This happens on GitLab.com

Possible fixes

We see the system note on the commit changes in the comment does not get added when the diff note is not outdatedhttps://gitlab.com/gitlab-org/gitlab/-/blob/v15.9.0-ee/app/services/discussions/update_diff_position_service.rb#L31.

The issue is possibly related to what constitute as an outdated for a diff note in a multi-line comment, where it is not detecting a diff note as outdated after a change, hence the system note for commit does not show up: https://gitlab.com/gitlab-org/gitlab/-/blob/v15.9.0-ee/lib/gitlab/diff/position_tracer/line_strategy.rb.

Edited by 🤖 GitLab Bot 🤖