File tree Expand file tree Collapse file tree 5 files changed +5
-9
lines changed Expand file tree Collapse file tree 5 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -362,11 +362,7 @@ func (repo *Repository) GetBranchProtection(branchName string) (*ProtectedBranch
362
362
}
363
363
364
364
// IsProtectedBranch checks if branch is protected
365
- func (repo * Repository ) IsProtectedBranch (branchName string , doer * User ) (bool , error ) {
366
- if doer == nil {
367
- return true , nil
368
- }
369
-
365
+ func (repo * Repository ) IsProtectedBranch (branchName string ) (bool , error ) {
370
366
protectedBranch := & ProtectedBranch {
371
367
RepoID : repo .ID ,
372
368
BranchName : branchName ,
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ func DeleteBranch(ctx *context.APIContext) {
122
122
return
123
123
}
124
124
125
- isProtected , err := ctx .Repo .Repository .IsProtectedBranch (branchName , ctx . User )
125
+ isProtected , err := ctx .Repo .Repository .IsProtectedBranch (branchName )
126
126
if err != nil {
127
127
ctx .InternalServerError (err )
128
128
return
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ func DeleteBranchPost(ctx *context.Context) {
89
89
return
90
90
}
91
91
92
- isProtected , err := ctx .Repo .Repository .IsProtectedBranch (branchName , ctx . User )
92
+ isProtected , err := ctx .Repo .Repository .IsProtectedBranch (branchName )
93
93
if err != nil {
94
94
log .Error ("DeleteBranch: %v" , err )
95
95
ctx .Flash .Error (ctx .Tr ("repo.branch.deletion_failed" , branchName ))
Original file line number Diff line number Diff line change @@ -1458,7 +1458,7 @@ func ViewIssue(ctx *context.Context) {
1458
1458
}
1459
1459
if perm .CanWrite (models .UnitTypeCode ) {
1460
1460
// Check if branch is not protected
1461
- if protected , err := pull .HeadRepo .IsProtectedBranch (pull .HeadBranch , ctx . User ); err != nil {
1461
+ if protected , err := pull .HeadRepo .IsProtectedBranch (pull .HeadBranch ); err != nil {
1462
1462
log .Error ("IsProtectedBranch: %v" , err )
1463
1463
} else if ! protected {
1464
1464
canDelete = true
Original file line number Diff line number Diff line change @@ -1190,7 +1190,7 @@ func CleanUpPullRequest(ctx *context.Context) {
1190
1190
}
1191
1191
1192
1192
// Check if branch is not protected
1193
- if protected , err := pr .HeadRepo .IsProtectedBranch (pr .HeadBranch , ctx . User ); err != nil || protected {
1193
+ if protected , err := pr .HeadRepo .IsProtectedBranch (pr .HeadBranch ); err != nil || protected {
1194
1194
if err != nil {
1195
1195
log .Error ("HeadRepo.IsProtectedBranch: %v" , err )
1196
1196
}
You can’t perform that action at this time.
0 commit comments