fix(sources): prevent 500 when deleting GitLab/GitHub apps

After delete, Livewire still re-renders the source change view (modal
$refresh / morph). Policy @can checks then call isAdminOfTeam() with a
null team_id and throw a TypeError (HTTP 500) before the redirect.

Guard null team_id in GitlabAppPolicy and GithubAppPolicy, clear the
Livewire model after delete, and skip @can when the model is gone.
This commit is contained in:
Andras Bacsai committed 2026-08-01 18:34:38 +02:00
1 parent f06bacc8e0
commit 5b370713c3
9 files changed
+150 -41

No files matched your search

+3
View File
@@ -478,6 +478,9 @@ class Change extends Component
return;
}
$this->github_app->delete();
// Clear so post-delete Livewire re-render / modal $refresh does not re-run
// @can and canGate checks against a deleted model (null team_id TypeError).
$this->github_app = null;
return redirect()->route('source.all');
} catch (\Throwable $e) {