0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-06-10 22:49:19 +02:00

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

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
}