| |
---|
| | */ |
---|
| | get ("/api/v3/repos/:owner/:repo/branches/:branch")(referrersOnly { repository => |
---|
| | //import gitbucket.core.api._ |
---|
| | (for{ |
---|
| | branch <- params.get("branch") if repository.branchList.find(_ == branch).isDefined |
---|
| | branch <- params.get("branch") if repository.branchList.contains(branch) |
---|
| | br <- getBranches(repository.owner, repository.name, repository.repository.defaultBranch, repository.repository.originUserName.isEmpty).find(_.name == branch) |
---|
| | } yield { |
---|
| | val protection = getProtectedBranchInfo(repository.owner, repository.name, branch) |
---|
| | JsonFormat(ApiBranch(branch, ApiBranchCommit(br.commitId), ApiBranchProtection(protection))(RepositoryName(repository))) |
---|
| |
---|
| | */ |
---|
| | patch("/api/v3/repos/:owner/:repo/branches/:branch")(ownerOnly { repository => |
---|
| | import gitbucket.core.api._ |
---|
| | (for{ |
---|
| | branch <- params.get("branch") if repository.branchList.find(_ == branch).isDefined |
---|
| | branch <- params.get("branch") if repository.branchList.contains(branch) |
---|
| | protection <- extractFromJsonBody[ApiBranchProtection.EnablingAndDisabling].map(_.protection) |
---|
| | br <- getBranches(repository.owner, repository.name, repository.repository.defaultBranch, repository.repository.originUserName.isEmpty).find(_.name == branch) |
---|
| | } yield { |
---|
| | if(protection.enabled){ |
---|
| |
---|
| | |