stable

Clone or download

Read-only

refactor: replace threads reply forms with <tuleap-pullrequest-new-comment-form/>

part of story #32316 Update comments Context: A comment has a reply form which can be toggled when the user clicks on the [Reply] button. This form was generated by a template function and managed by the component's controller. The writing zone was the component's one, and served only this purpose. In this user story, we are implementing an edition feature, which requires to use the writing zone as well. Sadly, it is not possible as it is to use the same writing zone for two purposes. The refactoring in this contribution aims to replace the good old template function by the already existing new-comment-form component. This component is used to create global and inline comments, both in the overview and changes pane. It looks and behaves exactly like the current reply form, except it does not create replies to a particular comment. Using "creation contexts" makes it possible to create new comments and replies, e.g: - we want to create a new global comment - we want to create a new inline comment on a particular file line - we want to reply to a global comment - we want to reply to an inline comment These actions are made by two different object: one to save new comments, one to save replies. And that's it. Thanks to this refactoring, we'll be able to have a dedicated writing zone to edit the comments. How to test: - You can add global and inline comments - You can answer to global and inline comments - Inline comments are created at the right place in the files - Replies are created using the current user Change-Id: I8fad99b5920dbf4271a8bfa9eb8982ef82f28a6f

Modified Files

Name
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestComment.ts +10 −37 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentController.test.ts +51 −58 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentController.ts +49 −73 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentPresenter.ts +9 −4 Go to diff View file
D plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentReplyFormTemplate.test.ts +0 −176 Go to diff View file
D plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentReplyFormTemplate.ts +0 −84 Go to diff View file
D plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentReplySaver.ts +0 −84 Go to diff View file
D plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/ReplyCommentFormPresenter.test.ts +0 −93 Go to diff View file
D plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/ReplyCommentFormPresenter.ts +0 −58 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/ReplyContext.test.ts +85 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/ReplyContext.ts +54 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/main.ts +0 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentFormController.test.ts +12 −15 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentFormController.ts +11 −13 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentFormPresenter.test.ts +59 −56 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentFormPresenter.ts +18 −15 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentFormTemplate.test.ts +4 −4 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentFormTemplate.ts +4 −5 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentSaver.test.ts +25 −7 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewCommentSaver.ts +9 −39 Go to diff View file
R plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentReplySaver.test.ts Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/NewReplySaver.ts +78 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/main.ts +3 −3 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/new-comment-form/types.ts +76 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/CurrentPullRequestPresenterStub.ts +4 −0 Go to diff View file
R plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/ReplyCommentFormPresenterStub.ts Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/PullRequestCommentControllerStub.ts +2 −3 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/PullRequestCommentPresenterStub.ts +2 −1 Go to diff View file
R plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/SaveNewCommentStub.ts Go to diff View file
D plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/SaveNewReplyToCommentStub.ts +0 −65 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/themes/includes/_comment.scss +2 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewNewCommentForm.vue +5 −4 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewThreads.vue +2 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-diff-component.js +2 −5 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/unidiff-component.js +2 −5 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/widgets/SideBySideCodeMirrorWidgetCreator.ts +7 −6 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileDiffWidgetStub.ts +1 −3 Go to diff View file