stable

Clone or download

Read-only

Be able to edit a pull request comment via REST route

Part of story #32316 Update comments Introduce the new route `PATCH pull_requests_comments/:id` route which update a global comment of a pull request To test: - Enable the feature flag `tuleap config-set feature_flag_allow_pull_requests_comments_edition 1` - launch at least 'make composer && make dev-clear-cache` - You can test with API explorer under the `pull_requests_comments` part - payload example: { "content": "B3 Touring" } => If the current user tries to edit a comment from another user an error is retruned => If the format is not `commonmark` then an error is returned => If the user does not have access to project / pull request or git repository, an error is returned => Else the wanted comment is edited and you can see it in the view => Nothing is returned by the route for now. It will be done later. Notes: To avoid using some `Factory` classes which can do so many stuff (such as build a car and retrieve a coffee at the same time), the retrieving of the pull request and comment are done in dedicated class. Since the review is already long enough, the refactoring of the `Factory` class will be done in dedicated commit. The REST tests will be also done in a dedicated commit Change-Id: I21d41d142932fdba2919ea490beea6e101e768e5

Modified Files

Name
A plugins/pullrequest/include/PullRequest/Authorization/CannotAccessToPullRequestFault.php +37 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/Authorization/CheckUserCanAccessPullRequest.php +39 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/Authorization/PullRequestPermissionChecker.php +4 −20 Go to diff View file
M plugins/pullrequest/include/PullRequest/Comment/Comment.php +28 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/Comment/CommentFormatNotAllowedFault.php +36 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/Comment/CommentIsNotFromCurrentUserFault.php +36 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/Comment/CommentNotFoundFault.php +36 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/Comment/CommentRetriever.php +46 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/Comment/CommentSearcher.php +28 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/Comment/CommentUpdater.php +29 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/Comment/Dao.php +24 −2 Go to diff View file
M plugins/pullrequest/include/PullRequest/Dao.php +19 −2 Go to diff View file
M plugins/pullrequest/include/PullRequest/PullRequest.php +20 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/PullRequestNotFoundFault.php +36 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/PullRequestRetriever.php +48 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/ResourcesInjector.class.php +2 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/Comment/PATCHCommentHandler.php +89 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/CommentPATCHRepresentation.php +38 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/FaultMapper.php +46 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/PullRequestCommentsResource.php +107 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/SearchPullRequest.php +28 −0 Go to diff View file
M plugins/pullrequest/site-content/fr_FR/LC_MESSAGES/tuleap-pullrequest.po +20 −0 Go to diff View file
M plugins/pullrequest/site-content/pt_BR/LC_MESSAGES/tuleap-pullrequest.po +19 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Comment/CommentRetrieverTest.php +60 −0 Go to diff View file
A plugins/pullrequest/tests/unit/PullRequestRetrieverTest.php +72 −0 Go to diff View file
A plugins/pullrequest/tests/unit/REST/FaultMapperTest.php +53 −0 Go to diff View file
A plugins/pullrequest/tests/unit/REST/v1/Comment/PATCHCommentHandlerTest.php +133 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Stub/CheckUserCanAccessPullRequestStub.php +55 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Stub/CommentSearcherStub.php +75 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Stub/CommentUpdaterStub.php +50 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Stub/SearchPullRequestStub.php +64 −0 Go to diff View file