From a352e4cbf716ad48d803a93904d162579b9fdbd8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Mar 2024 11:41:22 +0100 Subject: [PATCH] fix: public prs should not be commented --- app/Jobs/ApplicationPullRequestUpdateJob.php | 3 +++ app/Models/Application.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/app/Jobs/ApplicationPullRequestUpdateJob.php b/app/Jobs/ApplicationPullRequestUpdateJob.php index 85dde009d..74f7a7b67 100755 --- a/app/Jobs/ApplicationPullRequestUpdateJob.php +++ b/app/Jobs/ApplicationPullRequestUpdateJob.php @@ -30,6 +30,9 @@ class ApplicationPullRequestUpdateJob implements ShouldQueue, ShouldBeEncrypted public function handle() { try { + if ($this->application->is_public_repository()) { + return; + } if ($this->status === ProcessStatus::CLOSED) { $this->delete_comment(); return; diff --git a/app/Models/Application.php b/app/Models/Application.php index 7ebabf1b4..4c9f3e1af 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -65,6 +65,12 @@ class Application extends BaseModel return $this->belongsToMany(StandaloneDocker::class, 'additional_destinations') ->withPivot('server_id', 'status'); } + public function is_public_repository(): bool { + if (data_get($this, 'source.is_public')) { + return true; + } + return false; + } public function is_github_based(): bool { if (data_get($this, 'source')) {