stable

Clone or download

Read-only

Extract pullrequests app comments in a lib

part of story #31091 Add the hybrid comment to manage comments This contribution introduces @tuleap/plugin-pullrequest-comments, a lib belonging to the pullrequest plugin. We need it to be extracted from the angular code since we'll have to reuse this hybrids component in the pullrequest-overview app. What has been done: - The code regarding the display and management of comments is now available in plugins/pullrequest/scripts/lib/pullrequest-comments - All the stuff needed to instanciate the component is available to be imported from @tuleap/plugin-pullrequest-comments, such as its controller, reply saver, replies store, focus helper, as long as all types needed to build the presenters. - The unit tests of the component have been migrated to vitest - The translations are now managed using @tuleap/gettext - A part of the PullRequestPresenter has been left into pullrequest-app since it was not relevant to let the component build its own presenters (except in the "save reply" context). Moreover, we sure don't want to have specific angular things (State) polluting the code. We have a couple of duplicated stubs for the test, but it is no harm IMHO since the goal is to kill a part of the original app. These duplicated stubs may be removed during the process. - The styles of the component have been extracted too. Nevertheless, the themes/ folder not being in the same folder than the package.json file of pullrequests-app, it is not possible yet to @use "@tuleap/plugin-pullrequest-comments". It doesn't know were to look for it. This part obviously deserves a refactoring, but for the moment, I chose to import the styles directly from the lib's dist/ folder. How to test: - CI is happy (e.g unit tests + typecheck success) - No functional change expected: --> You can create comments from the pullrequest-app overview as usual --> You can reply to comments --> Started threads are colored --> You can comment on files, in both file diff modes --> When a comment is inline, to click on the file url will redirect you to the target comment in the target file Change-Id: I7f63a8029d7d6968ad54f27cfa27b2a72d77afd2

Modified Files

Name
M plugins/pullrequest/build-manifest.json +6 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/.gitignore +1 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/package.json +42 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/pnpm-lock.yaml +58 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/po/fr_FR.po +25 −0 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestComment.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestComment.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentBodyTemplate.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentBodyTemplate.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentController.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentController.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentFooterTemplate.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentFooterTemplate.ts Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentPresenter.test.ts +48 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentPresenter.ts +91 −0 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentRepliesCollectionPresenter.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentRepliesStore.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentRepliesStore.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentReplyFormFocusHelper.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentReplyFormTemplate.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentReplyFormTemplate.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentReplySaver.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentReplySaver.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentReplyTemplate.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCurrentUserPresenter.ts Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestPresenter.ts +22 −0 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/ReplyCommentFormPresenter.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/ReplyCommentFormPresenter.ts Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/gettext-provider.ts +27 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/main.ts +48 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/pofile-shims.d.ts +24 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/src/types.ts +35 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/CurrentPullRequestPresenterStub.ts +26 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/CurrentPullRequestUserPresenterStub.ts +27 −0 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FocusTextReplyToCommentAreaStub.ts Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/GettextProviderStub.ts +27 −0 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/tests/stubs/PullRequestCommentControllerStub.ts Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/PullRequestCommentPresenterStub.ts +104 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/RelativeDateHelperStub.ts +27 −0 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/tests/stubs/ReplyCommentFormPresenterStub.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/tests/stubs/SaveNewCommentStub.ts Go to diff View file
R plugins/pullrequest/themes/includes/_tuleap-pullrequest-comment.scss Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/tsconfig.json +7 −0 Go to diff View file
A plugins/pullrequest/scripts/lib/pullrequest-comments/vite.config.ts +33 −0 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/package.json +1 −0 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/pnpm-lock.yaml +2 −0 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/po/fr_FR.po +0 −9 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/app.js +1 −2 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentPresenter.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCommentPresenter.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCurrentUserPresenter.test.ts Go to diff View file
A plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCurrentUserPresenterBuilder.ts +27 −0 Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestPresenter.test.ts Go to diff View file
R plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestPresenter.ts Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/new-comment-form/NewInlineCommentContext.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/new-comment-form/NewInlineCommentForm.test.ts +3 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/new-comment-form/NewInlineCommentForm.ts +10 −8 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/new-comment-form/NewInlineCommentSaver.test.ts +3 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/new-comment-form/NewInlineCommentSaver.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/types.ts +2 −10 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/code-collapse/collapsible-code-sections-builder.test.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/code-collapse/collaspible-code-sections-builder.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-diff-component.js +13 −8 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/unidiff-component.js +14 −9 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/editors/comments-store.ts +5 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/file-diff-component.js +2 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/file-lines/SideBySideLineState.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/scroll-to-comment/FileDiffCommentScroller.test.ts +6 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/scroll-to-comment/FileDiffCommentScroller.ts +5 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/types-codemirror-overriden.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/types.ts +10 −12 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/widgets/SideBySideCodeMirrorWidgetCreator.test.ts +16 −11 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/widgets/SideBySideCodeMirrorWidgetCreator.ts +9 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/widgets/SideBySideCodeMirrorWidgetsCreationManager.test.ts +8 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/widgets/SideBySideCodeMirrorWidgetsCreationManager.ts +3 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/widgets/placeholders/FileDiffPlaceholder.ts +1 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/widgets/side-by-side-line-widgets-helper.ts +3 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/gettext-catalog.ts +3 −9 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/helpers/date-helpers.ts +2 −8 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/overview/timeline/timeline-controller.js +13 −9 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/overview/timeline/timeline-service.js +7 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/overview/timeline/timeline-service.test.js +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/CurrentPullRequestPresenterStub.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/CurrentPullRequestUserPresenterStub.ts +2 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileDiffWidgetStub.ts +7 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/InlineCommentContextStub.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/PullRequestCommentPresenterStub.ts +7 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/SaveNewInlineCommentStub.ts +2 −2 Go to diff View file
M plugins/pullrequest/themes/pull-requests.scss +1 −1 Go to diff View file