-                            
Sync Name
-                            
+                            
+                                Sync Name
+                            
+                            
                                 
-                                    Update
+                                    Rename
                                     
                                 
                             
From f51300a19213df0d29fbf0161fc91495bd296c52 Mon Sep 17 00:00:00 2001
From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Date: Tue, 3 Dec 2024 16:17:35 +0100
Subject: [PATCH 09/10] fix: client and webhook secret disappear after sync
---
 app/Livewire/Source/Github/Change.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/Livewire/Source/Github/Change.php b/app/Livewire/Source/Github/Change.php
index b1f0605bb..51c5ae3e9 100644
--- a/app/Livewire/Source/Github/Change.php
+++ b/app/Livewire/Source/Github/Change.php
@@ -56,6 +56,13 @@ class Change extends Component
         'github_app.administration' => 'nullable|string',
     ];
 
+    public function boot()
+    {
+        if ($this->github_app) {
+            $this->github_app->makeVisible(['client_secret', 'webhook_secret']);
+        }
+    }
+
     public function checkPermissions()
     {
         GithubAppPermissionJob::dispatchSync($this->github_app);
@@ -102,10 +109,10 @@ class Change extends Component
         try {
             $github_app_uuid = request()->github_app_uuid;
             $this->github_app = GithubApp::ownedByCurrentTeam()->whereUuid($github_app_uuid)->firstOrFail();
+            $this->github_app->makeVisible(['client_secret', 'webhook_secret']);
 
             $this->applications = $this->github_app->applications;
             $settings = instanceSettings();
-            $this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
 
             $this->name = str($this->github_app->name)->kebab();
             $this->fqdn = $settings->fqdn;
From c25be01af6881f13928a1ab64bc900eaa173464b Mon Sep 17 00:00:00 2001
From: Andras Bacsai 
Date: Thu, 5 Dec 2024 11:00:57 +0100
Subject: [PATCH 10/10] fix
---
 app/Livewire/Source/Github/Change.php | 6 +++++-
 database/seeders/GithubAppSeeder.php  | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/Livewire/Source/Github/Change.php b/app/Livewire/Source/Github/Change.php
index 51c5ae3e9..467927484 100644
--- a/app/Livewire/Source/Github/Change.php
+++ b/app/Livewire/Source/Github/Change.php
@@ -158,6 +158,10 @@ class Change extends Component
 
     public function getGithubAppNameUpdatePath()
     {
+        if (str($this->github_app->organization)->isNotEmpty()) {
+            return "{$this->github_app->html_url}/organizations/{$this->github_app->organization}/settings/apps/{$this->github_app->name}";
+        }
+
         return "{$this->github_app->html_url}/settings/apps/{$this->github_app->name}";
     }
 
@@ -184,7 +188,7 @@ class Change extends Component
     public function updateGithubAppName()
     {
         try {
-            $privateKey = PrivateKey::find($this->github_app->private_key_id);
+            $privateKey = PrivateKey::ownedByCurrentTeam()->find($this->github_app->private_key_id);
 
             if (! $privateKey) {
                 $this->dispatch('error', 'No private key found for this GitHub App.');
diff --git a/database/seeders/GithubAppSeeder.php b/database/seeders/GithubAppSeeder.php
index 2ece7a05b..3cfb82e64 100644
--- a/database/seeders/GithubAppSeeder.php
+++ b/database/seeders/GithubAppSeeder.php
@@ -23,6 +23,7 @@ class GithubAppSeeder extends Seeder
         GithubApp::create([
             'name' => 'coolify-laravel-development-public',
             'uuid' => '69420',
+            'organization' => 'coollabsio',
             'api_url' => 'https://api.github.com',
             'html_url' => 'https://github.com',
             'is_public' => false,