Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Refactor webhook handling logic to remove duplicate code and improve readability

Andras Bacsai9a127bdc80cb
diff --git a/routes/webhooks.php b/routes/webhooks.php
index 515b90d847..c831b88182 100644
--- a/routes/webhooks.php
+++ b/routes/webhooks.php
@@ -277,14 +277,6 @@ Route::post('/source/bitbucket/events/manual', function () {
]);
}
foreach ($applications as $application) {
- if (!$application->isPRDeployable()) {
- $return_payloads->push([
- 'application' => $application->name,
- 'status' => 'failed',
- 'message' => 'Preview deployments disabled.',
- ]);
- continue;
- }
$webhook_secret = data_get($application, 'manual_webhook_secret_bitbucket');
$payload = request()->getContent();
@@ -310,7 +302,7 @@ Route::post('/source/bitbucket/events/manual', function () {
continue;
}
if ($x_bitbucket_event === 'repo:push') {
- if ($application->isPRDeployable()) {
+ if ($application->isDeployable()) {
ray('Deploying ' . $application->name . ' with branch ' . $branch);
$deployment_uuid = new Cuid2(7);
queue_application_deployment(
@@ -328,7 +320,7 @@ Route::post('/source/bitbucket/events/manual', function () {
$return_payloads->push([
'application' => $application->name,
'status' => 'failed',
- 'message' => 'Preview deployments disabled.',
+ 'message' => 'Auto deployment disabled.',
]);
}
}