stable

Clone or download

Read-only

refactor: Extract replies as sub elements

part of story #32316 Update comments The goal of this refactoring is to extract the replies to a comment in a custom element to be reused each time we want to display a reply. We need a separate custom element because we want to be able to edit replies as well as the root comment. Those replies being each one a custom element, they can have their own WritingZone, and thus handle their own edition actions. Without this refactoring, we wouldn't be able to edit multiple comments at the same time in a same thread, and we would have to deal with clumsy detections and warnings (e.g "you cannot edit this comment because you are still editing another comment in the thread"). Weird. Before the refactoring, the replies were displayed by the root comment using a loop and common templates. We had to handle a few cases to make it work, since we had to know which comment was a reply, who wrote it etc. Now, we know we are handling a reply, and that's it. The counterpart of the refactoring, though, is a bit of code duplication here and there. For the moment, let's consider it harmless until I find a solution. How to test: --> No functional change when the feature flag is OFF in both overview and changes panes. --> No functional change when the feature flag is ON in both overview ans changes panes. To activate the feature flag: - tuleap config-set feature_flag_allow_pull_requests_comments_edition 1 Change-Id: Id105b9dbc057893245a8f72202dfabe077c9cfd4

Modified Files

Name
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestComment.test.ts +0 −32 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestComment.ts +19 −19 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentController.test.ts +0 −2 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentController.ts +6 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentFooterTemplate.test.ts +1 −9 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentFooterTemplate.ts +7 −29 Go to diff View file
D plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentReplyTemplate.ts +0 −73 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReply.test.ts +49 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReply.ts +74 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReplyController.test.ts +78 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReplyController.ts +56 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReplyFooterTemplate.test.ts +115 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReplyFooterTemplate.ts +80 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReplyTemplate.test.ts +115 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReplyTemplate.ts +103 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/main.ts +1 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/ControlPullRequestCommentReplyStub.ts +35 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/CurrentPullRequestPresenterStub.ts +10 −2 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/CurrentPullRequestUserPresenterStub.ts +13 −5 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/PullRequestCommentControllerStub.ts +2 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/themes/includes/_comment.scss +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileDiffWidgetStub.ts +1 −0 Go to diff View file