diff --git a/models/licenses/license_key.go b/models/licenses/license_key.go index 9e261bd9bd..ebd5efc909 100644 --- a/models/licenses/license_key.go +++ b/models/licenses/license_key.go @@ -130,10 +130,11 @@ func GetLicenseKeyByID(ctx context.Context, id int64) (*LicenseKey, error) { return key, nil } -// ListLicenseKeys returns all keys for the given owner. +// ListLicenseKeys returns all keys for the given owner, master keys first. func ListLicenseKeys(ctx context.Context, ownerID int64) ([]*LicenseKey, error) { keys := make([]*LicenseKey, 0, 20) - return keys, db.GetEngine(ctx).Where("owner_id = ?", ownerID).Find(&keys) + return keys, db.GetEngine(ctx).Where("owner_id = ?", ownerID). + OrderBy("is_internal DESC, created_unix DESC").Find(&keys) } // SearchLicenseKeys searches keys for an owner by key prefix/raw, licensee, email, or domain. diff --git a/templates/repo/licenses.tmpl b/templates/repo/licenses.tmpl index fec5e8c7d7..217017853a 100644 --- a/templates/repo/licenses.tmpl +++ b/templates/repo/licenses.tmpl @@ -26,27 +26,6 @@ {{end}} - {{/* ── Master Key Info ── */}} - {{if and .MasterKey .IsRepoAdmin}} -
{{.MasterKey.KeyPrefix}}
- {{if .MasterKey.IsActive}}
- {{ctx.Locale.Tr "repo.licenses.active"}}
- {{else}}
- {{ctx.Locale.Tr "repo.licenses.inactive"}}
- {{end}}
-