forked from forgejo/forgejo
Simplify CheckUnitUser logic (#12854)
if check one user's unit in different repos, it's not necessary to get user data every time. Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
07995e2301
commit
ec5677b7a2
4 changed files with 17 additions and 14 deletions
|
@ -140,7 +140,7 @@ func Create(ctx *context.Context) {
|
|||
templateID := ctx.QueryInt64("template_id")
|
||||
if templateID > 0 {
|
||||
templateRepo, err := models.GetRepositoryByID(templateID)
|
||||
if err == nil && templateRepo.CheckUnitUser(ctxUser.ID, ctxUser.IsAdmin, models.UnitTypeCode) {
|
||||
if err == nil && templateRepo.CheckUnitUser(ctxUser, models.UnitTypeCode) {
|
||||
ctx.Data["repo_template"] = templateID
|
||||
ctx.Data["repo_template_name"] = templateRepo.Name
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue