mirror of
https://github.com/go-gitea/gitea
synced 2024-09-27 16:56:49 +02:00
fix(user pin service): converted max number of pins to a constant
This commit is contained in:
parent
dae3c8ab28
commit
21400623ec
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user