fix ssh key migration broken with the new team check

This commit is contained in:
peaklabs-dev
2024-11-15 12:10:39 +01:00
parent 0045c5b7f4
commit 2932d9a6e0

View File

@@ -218,9 +218,14 @@ class PrivateKey extends BaseModel
private static function fingerprintExists($fingerprint, $excludeId = null)
{
return self::query()
->where('fingerprint', $fingerprint)
->where('team_id', currentTeam()->id)
$query = self::query()
->where('fingerprint', $fingerprint);
if (currentTeam()) {
$query->where('team_id', currentTeam()->id);
}
return $query
->when($excludeId, fn ($query) => $query->where('id', '!=', $excludeId))
->exists();
}