mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 03:07:55 +01:00
Fix bug on branch API (#10767)
This commit is contained in:
parent
661289d480
commit
83fe7d414e
@ -49,17 +49,21 @@ func ToBranch(repo *models.Repository, b *git.Branch, c *git.Commit, bp *models.
|
||||
branchProtectionName = bp.BranchName
|
||||
}
|
||||
|
||||
return &api.Branch{
|
||||
branch := &api.Branch{
|
||||
Name: b.Name,
|
||||
Commit: ToCommit(repo, c),
|
||||
Protected: true,
|
||||
RequiredApprovals: bp.RequiredApprovals,
|
||||
EnableStatusCheck: bp.EnableStatusCheck,
|
||||
StatusCheckContexts: bp.StatusCheckContexts,
|
||||
UserCanPush: bp.CanUserPush(user.ID),
|
||||
UserCanMerge: bp.IsUserMergeWhitelisted(user.ID),
|
||||
EffectiveBranchProtectionName: branchProtectionName,
|
||||
}
|
||||
|
||||
if user != nil {
|
||||
branch.UserCanPush = bp.CanUserPush(user.ID)
|
||||
branch.UserCanMerge = bp.IsUserMergeWhitelisted(user.ID)
|
||||
}
|
||||
return branch
|
||||
}
|
||||
|
||||
// ToBranchProtection convert a ProtectedBranch to api.BranchProtection
|
||||
|
Loading…
Reference in New Issue
Block a user