Allow suggesting single line changes in diffs
What does this MR do?
Allow suggesting single line changes in MR diffs.
- Creates a
suggestions
DB table - Introduces a
/api/v4/suggestions/:id/apply
API - Allows users using ```suggestion syntax to suggest changes in MRs
- These changes are presented as a diff table in the created
note
- Users with authorization can click Apply suggestion and this will add commit to the source branch
- Outdated suggestions (the commented line changes) are not appliable
Feature flag
- If disabled; the syntax will stop generating the suggestion table
- If disabled; existing suggestion tables will be presented (they're persisted in
note_html
already) - If disabled; users won't be able to apply the already existing suggestions
- If disabled; the "Insert suggestion" button in the toolbar will not be presented
Important points
- Documentation will be added in a separate MR
- Port to EE
- [EE] Draft notes (review comments) doesn't support the diff rendering, but the diff appear after its submission (see https://gitlab.slack.com/archives/CE3DX19EX/p1543616087001000)
- Highlighting is slightly limited, we're currently not presenting syntax highlighting
- Review app: https://gitlab-review-osw-sugges-j15ey3.ce.gitlab-review.app/root/test-project/merge_requests/1/diffs
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/18008
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary - [ ] Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.
Edited by Oswaldo Ferreira