fix: remove private key in case you removed a github app
This commit is contained in:
parent
f4819a849b
commit
ac133875fa
@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
|
|||||||
|
|
||||||
class GithubApp extends BaseModel
|
class GithubApp extends BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
protected $appends = ['type'];
|
protected $appends = ['type'];
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -17,6 +18,7 @@ class GithubApp extends BaseModel
|
|||||||
'webhook_secret',
|
'webhook_secret',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
static public function public()
|
static public function public()
|
||||||
{
|
{
|
||||||
return GithubApp::whereTeamId(currentTeam()->id)->whereisPublic(true)->whereNotNull('app_id')->get();
|
return GithubApp::whereTeamId(currentTeam()->id)->whereisPublic(true)->whereNotNull('app_id')->get();
|
||||||
@ -34,6 +36,7 @@ class GithubApp extends BaseModel
|
|||||||
if ($applications_count > 0) {
|
if ($applications_count > 0) {
|
||||||
throw new \Exception('You cannot delete this GitHub App because it is in use by ' . $applications_count . ' application(s). Delete them first.');
|
throw new \Exception('You cannot delete this GitHub App because it is in use by ' . $applications_count . ' application(s). Delete them first.');
|
||||||
}
|
}
|
||||||
|
$github_app->privateKey()->delete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user