chore: Remove UpdateTeamUnits
		
	- Introduced in0b3ea42847and removed inb7221bec34.
This commit is contained in:
		
					parent
					
						
							
								66d252bc2b
							
						
					
				
			
			
				commit
				
					
						9a406757f5
					
				
			
		
					 3 changed files with 1 additions and 24 deletions
				
			
		| 
						 | 
				
			
			@ -42,7 +42,6 @@ code.gitea.io/gitea/models/issues
 | 
			
		|||
	IsErrIssueWasClosed
 | 
			
		||||
 | 
			
		||||
code.gitea.io/gitea/models/organization
 | 
			
		||||
	UpdateTeamUnits
 | 
			
		||||
	SearchMembersOptions.ToConds
 | 
			
		||||
 | 
			
		||||
code.gitea.io/gitea/models/perm/access
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,24 +28,3 @@ func (t *TeamUnit) Unit() unit.Unit {
 | 
			
		|||
func getUnitsByTeamID(ctx context.Context, teamID int64) (units []*TeamUnit, err error) {
 | 
			
		||||
	return units, db.GetEngine(ctx).Where("team_id = ?", teamID).Find(&units)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateTeamUnits updates a teams's units
 | 
			
		||||
func UpdateTeamUnits(ctx context.Context, team *Team, units []TeamUnit) (err error) {
 | 
			
		||||
	ctx, committer, err := db.TxContext(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer committer.Close()
 | 
			
		||||
 | 
			
		||||
	if _, err = db.GetEngine(ctx).Where("team_id = ?", team.ID).Delete(new(TeamUnit)); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(units) > 0 {
 | 
			
		||||
		if err = db.Insert(ctx, units); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return committer.Commit()
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -272,8 +272,7 @@ func TestRepoPermissionPrivateOrgRepo(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
	// update team information and then check permission
 | 
			
		||||
	team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: 5})
 | 
			
		||||
	err = organization.UpdateTeamUnits(db.DefaultContext, team, nil)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	unittest.AssertSuccessfulDelete(t, &organization.TeamUnit{TeamID: team.ID})
 | 
			
		||||
	perm, err = access_model.GetUserRepoPermission(db.DefaultContext, repo, owner)
 | 
			
		||||
	require.NoError(t, err)
 | 
			
		||||
	for _, unit := range repo.Units {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue