@@ -79,38 +79,38 @@ func UpdateGroupTeam(ctx context.Context, gt *group_model.GroupTeam) (err error)
7979
8080// RecalculateGroupAccess recalculates team access to a group.
8181// should only be called if and only if a group was moved from another group.
82- func RecalculateGroupAccess (ctx context.Context , g * group_model.Group , isNew bool ) (err error ) {
82+ func RecalculateGroupAccess (ctx context.Context , g * group_model.Group , isNew bool ) error {
83+ var err error
8384 sess := db .GetEngine (ctx )
8485 if err = g .LoadParentGroup (ctx ); err != nil {
85- return
86+ return err
8687 }
8788 var teams []* org_model.Team
8889 if g .ParentGroup == nil {
8990 teams , err = org_model .FindOrgTeams (ctx , g .OwnerID )
9091 if err != nil {
91- return
92+ return err
9293 }
9394 } else {
9495 teams , err = org_model .GetTeamsWithAccessToGroup (ctx , g .OwnerID , g .ParentGroupID , perm .AccessModeRead )
9596 }
9697 for _ , t := range teams {
97-
9898 var gt * group_model.GroupTeam = nil
9999 if gt , err = group_model .FindGroupTeamByTeamID (ctx , g .ParentGroupID , t .ID ); err != nil {
100100 return
101101 }
102102 if gt != nil {
103103 if err = group_model .UpdateTeamGroup (ctx , g .OwnerID , t .ID , g .ID , gt .AccessMode , gt .CanCreateIn , isNew ); err != nil {
104- return
104+ return err
105105 }
106106 } else {
107107 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 {
108- return
108+ return err
109109 }
110110 }
111111
112112 if err = t .LoadUnits (ctx ); err != nil {
113- return
113+ return err
114114 }
115115 for _ , u := range t .Units {
116116
@@ -129,7 +129,7 @@ func RecalculateGroupAccess(ctx context.Context, g *group_model.Group, isNew boo
129129 GroupID : g .ID ,
130130 AccessMode : newAccessMode ,
131131 }); err != nil {
132- return
132+ return err
133133 }
134134 } else {
135135 if _ , err = sess .Table ("group_unit" ).Where (builder.Eq {
@@ -144,5 +144,5 @@ func RecalculateGroupAccess(ctx context.Context, g *group_model.Group, isNew boo
144144 }
145145 }
146146 }
147- return
147+ return err
148148}
0 commit comments