0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-04 10:05:18 +02:00

apply simple linting changes

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-08-13 16:21:41 -04:00
parent 47531417e9
commit f627e57199
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C
2 changed files with 12 additions and 10 deletions

View File

@ -2,6 +2,7 @@ package group
import (
"context"
"fmt"
"strings"
"code.gitea.io/gitea/models/db"
@ -13,7 +14,8 @@ import (
"code.gitea.io/gitea/modules/util"
)
func NewGroup(ctx context.Context, g *group_model.Group) (err error) {
func NewGroup(ctx context.Context, g *group_model.Group) error {
var err error
if len(g.Name) == 0 {
return util.NewInvalidArgumentErrorf("empty group name")
}

View File

@ -79,38 +79,38 @@ func UpdateGroupTeam(ctx context.Context, gt *group_model.GroupTeam) (err error)
// RecalculateGroupAccess recalculates team access to a group.
// should only be called if and only if a group was moved from another group.
func RecalculateGroupAccess(ctx context.Context, g *group_model.Group, isNew bool) (err error) {
func RecalculateGroupAccess(ctx context.Context, g *group_model.Group, isNew bool) error {
var err error
sess := db.GetEngine(ctx)
if err = g.LoadParentGroup(ctx); err != nil {
return
return err
}
var teams []*org_model.Team
if g.ParentGroup == nil {
teams, err = org_model.FindOrgTeams(ctx, g.OwnerID)
if err != nil {
return
return err
}
} else {
teams, err = org_model.GetTeamsWithAccessToGroup(ctx, g.OwnerID, g.ParentGroupID, perm.AccessModeRead)
}
for _, t := range teams {
var gt *group_model.GroupTeam = nil
if gt, err = group_model.FindGroupTeamByTeamID(ctx, g.ParentGroupID, t.ID); err != nil {
return
}
if gt != nil {
if err = group_model.UpdateTeamGroup(ctx, g.OwnerID, t.ID, g.ID, gt.AccessMode, gt.CanCreateIn, isNew); err != nil {
return
return err
}
} else {
if err = group_model.UpdateTeamGroup(ctx, g.OwnerID, t.ID, g.ID, t.AccessMode, t.IsOwnerTeam() || t.AccessMode >= perm.AccessModeAdmin || t.CanCreateOrgRepo, isNew); err != nil {
return
return err
}
}
if err = t.LoadUnits(ctx); err != nil {
return
return err
}
for _, u := range t.Units {
@ -129,7 +129,7 @@ func RecalculateGroupAccess(ctx context.Context, g *group_model.Group, isNew boo
GroupID: g.ID,
AccessMode: newAccessMode,
}); err != nil {
return
return err
}
} else {
if _, err = sess.Table("group_unit").Where(builder.Eq{
@ -144,5 +144,5 @@ func RecalculateGroupAccess(ctx context.Context, g *group_model.Group, isNew boo
}
}
}
return
return err
}