fix(user pin service): converted max number of pins to a constant

This commit is contained in:
Daniel Carvalho 2024-05-17 15:38:26 +00:00
parent dae3c8ab28
commit 21400623ec
1 changed files with 4 additions and 1 deletions

View File

@ -14,6 +14,8 @@ import (
"code.gitea.io/gitea/services/context"
)
const maxPins = 6
// Check if a user have a new pinned repo in it's profile, meaning that it
// has permissions to pin said repo and also has enough space on the pinned list.
func CanPin(ctx *context.Context, u *user_model.User, r *repo_model.Repository) bool {
@ -27,7 +29,8 @@ func CanPin(ctx *context.Context, u *user_model.User, r *repo_model.Repository)
ctx.ServerError("GetPinnedRepos", err)
return false
}
if len(repos) >= 6 {
if len(repos) >= maxPins {
return false
}