stable

Clone or download

Read-only

refactor: extract action events from <tuleap-pullrequest-comment/>

part of story #32316 Update comments Context: In the begining of the work on pull-requests comments, action events and regular comments were merged together. It was kind of fine at this time because we only needed to display them. With the addition of features to the comments, such as the ability to reply to a comment to create a thread, or edit an already existing comment, it does not make sense anymore. The goal of this refactoring is to extract what's related to action events out of the <tuleap-pullrequest-comment/> component, in a dedicated custom element. The benefits are: - It is easier to build a PullRequestCommentPresenter. - There is no need to check the type of item we are displaying anymore (except for global vs inline comments). - We can handle action events messages and their translations inside the dedicated custom element. - Action events presenters now contain only a few attributes instead of a ton of useless keys containing default values. Nevertheless, the rendering of the timeline is a bit more complex given that we now have to differentiate action events and comments, display them in the right order and instantiate the right custom element. How to test: --> No functional change expected Change-Id: I67cddc46f0ee84ca39a169b295f05b5e687b1759

Modified Files

Name
M plugins/pullrequest/scripts/lib/constants/src/constants.ts +8 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/po/fr_FR.po +15 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestComment.test.ts +0 −17 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentBodyTemplate.test.ts +0 −4 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentBodyTemplate.ts +10 −18 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentFooterTemplate.test.ts +0 −5 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentFooterTemplate.ts +1 −8 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentPresenter.ts +1 −9 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentRepliesStore.test.ts +0 −15 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/ReplyContext.test.ts +0 −10 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/ReplyContext.ts +0 −6 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/main.ts +1 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/timeline-event/TimelineEvent.ts +82 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/timeline-event/TimelineEventPresenter.test.ts +42 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/timeline-event/TimelineEventPresenter.ts +65 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/timeline-event/main.ts +20 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/types.ts +0 −14 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/ActionEventStub.ts +63 −0 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/PullRequestCommentPresenterStub.ts +0 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/po/fr_FR.po +0 −15 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/CommentPresenterBuilder.test.ts +3 −62 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/CommentPresenterBuilder.ts +10 −94 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewNewCommentForm.vue +1 −4 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewThreads.test.ts +32 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewThreads.vue +75 −44 Go to diff View file