PageRenderTime 26ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/user/discussions/index.md

https://gitlab.com/realsatomic/gitlab
Markdown | 334 lines | 217 code | 117 blank | 0 comment | 0 complexity | 04ffe42377d71ed5c4381445694ccc1b MD5 | raw file
  1. ---
  2. stage: Create
  3. group: Code Review
  4. info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
  5. type: reference, howto
  6. ---
  7. # Comments and threads **(FREE)**
  8. GitLab encourages communication through comments, threads, and
  9. [code suggestions](../project/merge_requests/reviews/suggestions.md).
  10. Two types of comments are available:
  11. - A standard comment.
  12. - A comment in a thread, which can be [resolved](#resolve-a-thread).
  13. In a comment, you can enter [Markdown](../markdown.md) and use [quick actions](../project/quick_actions.md).
  14. You can [suggest code changes](../project/merge_requests/reviews/suggestions.md) in your commit diff comment,
  15. which the user can accept through the user interface.
  16. ## Places you can add comments
  17. You can create comments in places like:
  18. - Commit diffs
  19. - Commits
  20. - Designs
  21. - Epics
  22. - Issues
  23. - Merge requests
  24. - Snippets
  25. Each object can have as many as 5,000 comments.
  26. ## Mentions
  27. You can mention a user or a group (including [subgroups](../group/subgroups/index.md#mention-subgroups)) in your GitLab
  28. instance with `@username` or `@groupname`. All mentioned users are notified with to-do items and emails.
  29. Users can change this setting for themselves in the [notification settings](../profile/notifications.md).
  30. You can quickly see which comments involve you, because
  31. mentions for yourself (the user currently signed in) are highlighted
  32. in a different color.
  33. Avoid mentioning `@all` in issues and merge requests, because it sends an email notification
  34. to all the members of that project's group. This might be interpreted as spam.
  35. Notifications and mentions can be disabled in
  36. [a group's settings](../group/index.md#disable-email-notifications).
  37. ## Add a comment to a merge request diff
  38. You can add comments to a merge request diff. These comments
  39. persist, even when you:
  40. - Force-push after a rebase.
  41. - Amend a commit.
  42. To add a commit diff comment:
  43. 1. To select a specific commit, on the merge request, select the **Commits** tab, select the commit
  44. message. To view the latest commit, select the **Changes** tab.
  45. 1. By the line you want to comment on, hover over the line number and select **Comment** (**{comment}**).
  46. You can select multiple lines by dragging the **Comment** (**{comment}**) icon.
  47. 1. Enter your comment and select **Start a review** or **Add comment now**.
  48. The comment is displayed on the merge request's **Discussions** tab.
  49. The comment is not displayed on your project's **Repository > Commits** page.
  50. NOTE:
  51. When your comment contains a reference to a commit included in the merge request,
  52. it's automatically converted to a link in the context of the current merge request.
  53. For example, `28719b171a056960dfdc0012b625d0b47b123196` becomes
  54. `https://gitlab.example.com/example-group/example-project/-/merge_requests/12345/diffs?commit_id=28719b171a056960dfdc0012b625d0b47b123196`.
  55. ## Add a comment to a commit
  56. You can add comments and threads to a particular commit.
  57. 1. On the top bar, select **Menu > Projects** and find your project.
  58. 1. On the left sidebar, select **Repository > Commits**.
  59. 1. Below the commits, in the **Comment** field, enter a comment.
  60. 1. Select **Comment** or select the down arrow (**{chevron-down}**) to select **Start thread**.
  61. WARNING:
  62. Threads created this way are lost if the commit ID changes after a
  63. force push.
  64. ## Add a comment to an image
  65. In merge requests and commit detail views, you can add a comment to an image.
  66. This comment can also be a thread.
  67. 1. Hover your mouse over the image.
  68. 1. Select the location where you want to comment.
  69. An icon is displayed on the image and a comment field is displayed.
  70. ![Start image thread](img/start_image_discussion.gif)
  71. ## Reply to a comment by sending email
  72. If you have ["reply by email"](../../administration/reply_by_email.md) configured,
  73. you can reply to comments by sending an email.
  74. - When you reply to a standard comment, it creates another standard comment.
  75. - When you reply to a threaded comment, it creates a reply in the thread.
  76. - When you [send an email to an issue email address](../project/issues/managing_issues.md#copy-issue-email-address),
  77. it creates a standard comment.
  78. You can use [Markdown](../markdown.md) and [quick actions](../project/quick_actions.md) in your email replies.
  79. ## Edit a comment
  80. You can edit your own comment at any time.
  81. Anyone with at least the Maintainer role can also edit a comment made by someone else.
  82. To edit a comment:
  83. 1. On the comment, select **Edit comment** (**{pencil}**).
  84. 1. Make your edits.
  85. 1. Select **Save changes**.
  86. ### Editing a comment to add a mention
  87. By default, when you mention a user, GitLab [creates a to-do item](../todos.md#actions-that-create-to-do-items)
  88. for them, and sends them a [notification email](../profile/notifications.md).
  89. If you edit an existing comment to add a user mention that wasn't there before, GitLab:
  90. - Creates a to-do item for the mentioned user.
  91. - Does not send a notification email.
  92. ## Prevent comments by locking an issue
  93. You can prevent public comments in an issue or merge request.
  94. When you do, only project members can add and edit comments.
  95. Prerequisite:
  96. - In merge requests, you must have at least the Developer role.
  97. - In issues, you must have at least the Reporter role.
  98. 1. On the right sidebar, next to **Lock issue** or **Lock merge request**, select **Edit**.
  99. 1. On the confirmation dialog, select **Lock**.
  100. Notes are added to the page details.
  101. If an issue or merge request is locked and closed, you cannot reopen it.
  102. ## Mark a comment as confidential **(FREE SELF)**
  103. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207473) in GitLab 13.9 [with a flag](../../administration/feature_flags.md) named `confidential_notes`. Disabled by default.
  104. FLAG:
  105. On self-managed GitLab, by default this feature is not available. To make it available,
  106. ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `confidential_notes`.
  107. On GitLab.com, this feature is not available.
  108. You should not use this feature for production environments.
  109. You can make a comment confidential, so that it is visible only to project members
  110. who have at least the Reporter role.
  111. 1. Below the comment, select the **Make this comment confidential** checkbox.
  112. 1. Select **Comment**.
  113. ![Confidential comments](img/confidential_comments_v13_9.png)
  114. You can also make an [entire issue confidential](../project/issues/confidential_issues.md).
  115. ## Show only comments
  116. For issues and merge requests with many comments, you can filter the page to show comments only.
  117. 1. Open a merge request's **Discussion** tab, or epic or issue's **Overview** tab.
  118. 1. On the right side of the page, select from the filter:
  119. - **Show all activity**: Display all user comments and system notes.
  120. (issue updates, mentions from other issues, changes to the description, and so on).
  121. - **Show comments only**: Display only user comments.
  122. - **Show history only**: Display only activity notes.
  123. ![Notes filters dropdown options](img/index_notes_filters.png)
  124. GitLab saves your preference, so it persists when you visit the same page again
  125. from any device you're logged into.
  126. ## View description change history **(PREMIUM)**
  127. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10103) in GitLab 12.6.
  128. You can see changes to the description listed in the history.
  129. To compare the changes, select **Compare with previous version**.
  130. ## Change activity sort order
  131. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14588) in GitLab 12.10.
  132. You can reverse the default order and interact with the activity feed sorted by most recent items
  133. at the top. Your preference is saved in local storage and automatically applies to every issue,
  134. merge request, or epic you view.
  135. To change the activity sort order:
  136. 1. Select the **Oldest first** (or **Newest first**) dropdown list.
  137. 1. Select either oldest or newest items to be shown first.
  138. ## Assign an issue to the commenting user
  139. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/191455) in GitLab 13.1.
  140. You can assign an issue to a user who made a comment.
  141. 1. In the comment, select the **More Actions** (**{ellipsis_v}**) menu.
  142. 1. Select **Assign to commenting user**:
  143. ![Assign to commenting user](img/quickly_assign_commenter_v13_1.png)
  144. 1. To unassign the commenter, select the button again.
  145. ## Create a thread by replying to a standard comment
  146. When you reply to a standard comment, you create a thread.
  147. Prerequisites:
  148. - You must have at least the Guest role.
  149. - You must be in an issue, merge request, or epic. Threads in commits and snippets are not supported.
  150. To create a thread by replying to a comment:
  151. 1. On the top right of the comment, select **Reply to comment** (**{comment}**).
  152. ![Reply to comment button](img/reply_to_comment_button.png)
  153. The reply section is displayed.
  154. 1. Enter your reply.
  155. 1. Select **Comment** or **Add comment now** (depending on where in the UI you are replying).
  156. The top comment is converted to a thread.
  157. ## Create a thread without replying to a comment
  158. You can create a thread without replying to a standard comment.
  159. Prerequisites:
  160. - You must have at least the Guest role.
  161. - You must be in an issue, merge request, commit, or snippet.
  162. To create a thread:
  163. 1. Enter a comment.
  164. 1. Below the comment, to the right of the **Comment** button, select the down arrow (**{chevron-down}**).
  165. 1. From the list, select **Start thread**.
  166. 1. Select **Start thread** again.
  167. A threaded comment is created.
  168. ![Thread comment](img/discussion_comment.png)
  169. ## Resolve a thread
  170. > Resolving comments individually was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/28750) in GitLab 13.6.
  171. In a merge request, you can resolve a thread when you want to finish a conversation.
  172. Prerequisites:
  173. - You must have at least the Developer role
  174. or be the author of the change being reviewed.
  175. - Resolvable threads can be added only to merge requests. It doesn't work
  176. for comments in issues, commits, or snippets.
  177. To resolve a thread:
  178. 1. Go to the thread.
  179. 1. Do one of the following:
  180. - In the top right of the original comment, select the **Resolve thread** (**{check-circle}**) icon.
  181. - Below the last reply, in the **Reply** field, select **Resolve thread**.
  182. - Below the last reply, in the **Reply** field, enter text, select the **Resolve thread** checkbox, and select **Add comment now**.
  183. At the top of the page, the number of unresolved threads is updated:
  184. ![Count of unresolved threads](img/unresolved_threads_v14_1.png)
  185. ### Move all unresolved threads in a merge request to an issue
  186. If you have multiple unresolved threads in a merge request, you can
  187. create an issue to resolve them separately. In the merge request, at the top of the page,
  188. select **Create issue to resolve all threads** (**{issue-new}**):
  189. ![Open new issue for all unresolved threads](img/create-new-issue_v14_3.png)
  190. All threads are marked as resolved, and a link is added from the merge request to
  191. the newly created issue.
  192. ### Move one unresolved thread in a merge request to an issue
  193. If you have one specific unresolved thread in a merge request, you can
  194. create an issue to resolve it separately. In the merge request, under the last reply
  195. to the thread, next to **Resolve thread**, select **Create issue to resolve thread** (**{issue-new}**):
  196. ![Create issue for thread](img/new-issue-one-thread_v14_3.png)
  197. The thread is marked as resolved, and a link is added from the merge request to
  198. the newly created issue.
  199. ### Prevent merge unless all threads are resolved
  200. You can prevent merge requests from being merged until all threads are
  201. resolved.
  202. 1. On the top bar, select **Menu > Projects** and find your project.
  203. 1. On the left sidebar, select **Settings > General**.
  204. 1. Expand **Merge requests**.
  205. 1. Under **Merge checks**, select the **All discussions must be resolved** checkbox.
  206. 1. Select **Save changes**.
  207. ### Automatically resolve threads in a merge request when they become outdated
  208. You can set merge requests to automatically resolve threads when lines are modified
  209. with a new push.
  210. 1. On the top bar, select **Menu > Projects** and find your project.
  211. 1. On the left sidebar, select **Settings > General**.
  212. 1. Expand **Merge requests**.
  213. 1. Under **Merge options**, select the
  214. **Automatically resolve merge request diff discussions when they become outdated** checkbox.
  215. 1. Select **Save changes**.
  216. Threads are now resolved if a push makes a diff section outdated.
  217. Threads on lines that don't change and top-level resolvable threads are not resolved.