stable

Clone or download

Read-only

Extract PR mergeability verification to limit code duplication

This code to do this verification already exist in two different code sections and it will also be needed to determine if a user has the rights to access to the reviewer autocompleter endpoint. This contribution only moves the code in one place to avoid duplicating it a third time. It is still not a great architecture because the check can easily be forgotten by a developper but at the very least the verification has more chances to be consistent between different actions. No functionnal changes are expected Part of story #14190: get email notifications on pull requests - first stage Change-Id: I6a83a86d9df578366d392da8810732b9cc489978

Modified Files

Name
M plugins/pullrequest/include/PullRequest/Authorization/PullRequestPermissionChecker.php +42 −7 Go to diff View file
A plugins/pullrequest/include/PullRequest/Authorization/UserCannotMergePullRequestException.php +33 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/PullRequestsResource.php +18 −9 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/StatusPatcher.php +17 −19 Go to diff View file
M plugins/pullrequest/include/pullrequestPlugin.php +6 −1 Go to diff View file
M plugins/pullrequest/phpunit/Authorization/PullRequestPermissionCheckerTest.php +50 −12 Go to diff View file
M plugins/pullrequest/phpunit/REST/v1/StatusPatcherTest.php +22 −43 Go to diff View file