fix: system-wide GitHub apps (#5114)
- fix(ui): system-wide GitHub Apps are not shown in the create a new Application dialog - fix: query logic error that shows all system-wide apps, regardless of whether they are public or private. - fix: clicking on a system-wide GitHub app from a team other than the one that created it resulted in a 404 error.
This commit is contained in:
@@ -33,17 +33,30 @@ class GithubApp extends BaseModel
|
||||
|
||||
public static function ownedByCurrentTeam()
|
||||
{
|
||||
return GithubApp::whereTeamId(currentTeam()->id);
|
||||
return GithubApp::where(function ($query) {
|
||||
$query->where('team_id', currentTeam()->id)
|
||||
->orWhere('is_system_wide', true);
|
||||
});
|
||||
}
|
||||
|
||||
public static function public()
|
||||
{
|
||||
return GithubApp::whereTeamId(currentTeam()->id)->whereisPublic(true)->whereNotNull('app_id')->get();
|
||||
return GithubApp::where(function ($query) {
|
||||
$query->where(function ($q) {
|
||||
$q->where('team_id', currentTeam()->id)
|
||||
->orWhere('is_system_wide', true);
|
||||
})->where('is_public', true);
|
||||
})->whereNotNull('app_id')->get();
|
||||
}
|
||||
|
||||
public static function private()
|
||||
{
|
||||
return GithubApp::whereTeamId(currentTeam()->id)->whereisPublic(false)->whereNotNull('app_id')->get();
|
||||
return GithubApp::where(function ($query) {
|
||||
$query->where(function ($q) {
|
||||
$q->where('team_id', currentTeam()->id)
|
||||
->orWhere('is_system_wide', true);
|
||||
})->where('is_public', false);
|
||||
})->whereNotNull('app_id')->get();
|
||||
}
|
||||
|
||||
public function team()
|
||||
|
||||
Reference in New Issue
Block a user