diff --git a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala index d2af068..1db2f5d 100644 --- a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala @@ -137,7 +137,7 @@ val protection = ApiBranchProtection(getProtectedBranchInfo(repository.owner, repository.name, branch)) val lastWeeks = getRecentStatuesContexts(repository.owner, repository.name, org.joda.time.LocalDateTime.now.minusWeeks(1).toDate).toSet val knownContexts = (lastWeeks ++ protection.status.contexts).toSeq.sortBy(identity) - html.brancheprotection(repository, branch, protection, knownContexts, flash.get("info")) + html.branchprotection(repository, branch, protection, knownContexts, flash.get("info")) } }); diff --git a/src/main/scala/gitbucket/core/model/ProtectedBranch.scala b/src/main/scala/gitbucket/core/model/ProtectedBranch.scala index dcc26c4..4700a04 100644 --- a/src/main/scala/gitbucket/core/model/ProtectedBranch.scala +++ b/src/main/scala/gitbucket/core/model/ProtectedBranch.scala @@ -15,8 +15,8 @@ def byPrimaryKey(userName: Column[String], repositoryName: Column[String], branch: Column[String]) = byBranch(userName, repositoryName, branch) } - lazy val ProtectedBrancheContexts = TableQuery[ProtectedBrancheContexts] - class ProtectedBrancheContexts(tag: Tag) extends Table[ProtectedBranchContext](tag, "PROTECTED_BRANCH_REQUIRE_CONTEXT") with BranchTemplate { + lazy val ProtectedBranchContexts = TableQuery[ProtectedBranchContexts] + class ProtectedBranchContexts(tag: Tag) extends Table[ProtectedBranchContext](tag, "PROTECTED_BRANCH_REQUIRE_CONTEXT") with BranchTemplate { val context = column[String]("CONTEXT") def * = (userName, repositoryName, branch, context) <> (ProtectedBranchContext.tupled, ProtectedBranchContext.unapply) } diff --git a/src/main/scala/gitbucket/core/service/ProtectedBrancheService.scala b/src/main/scala/gitbucket/core/service/ProtectedBrancheService.scala index 40f398e..c9518b1 100644 --- a/src/main/scala/gitbucket/core/service/ProtectedBrancheService.scala +++ b/src/main/scala/gitbucket/core/service/ProtectedBrancheService.scala @@ -14,7 +14,7 @@ import ProtectedBrancheService._ private def getProtectedBranchInfoOpt(owner: String, repository: String, branch: String)(implicit session: Session): Option[ProtectedBranchInfo] = ProtectedBranches - .leftJoin(ProtectedBrancheContexts) + .leftJoin(ProtectedBranchContexts) .on{ case (pb, c) => pb.byBranch(c.userName, c.repositoryName, c.branch) } .map{ case (pb, c) => pb -> c.context.? } .filter(_._1.byPrimaryKey(owner, repository, branch)) @@ -38,7 +38,7 @@ disableBranchProtection(owner, repository, branch) ProtectedBranches.insert(new ProtectedBranch(owner, repository, branch, includeAdministrators)) contexts.map{ context => - ProtectedBrancheContexts.insert(new ProtectedBranchContext(owner, repository, branch, context)) + ProtectedBranchContexts.insert(new ProtectedBranchContext(owner, repository, branch, context)) } } diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index fd2549c..8e74642 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -46,20 +46,20 @@ (Repositories filter { t => t.byRepository(oldUserName, oldRepositoryName) } firstOption).map { repository => Repositories insert repository.copy(userName = newUserName, repositoryName = newRepositoryName) - val webHooks = WebHooks .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val webHookEvents = WebHookEvents .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val milestones = Milestones .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val issueId = IssueId .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val issues = Issues .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val pullRequests = PullRequests .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val labels = Labels .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val issueComments = IssueComments .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val issueLabels = IssueLabels .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val commitComments = CommitComments .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val commitStatuses = CommitStatuses .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val collaborators = Collaborators .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val protectedBranches = ProtectedBranches .filter(_.byRepository(oldUserName, oldRepositoryName)).list - val protectedBrancheContexts = ProtectedBrancheContexts .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val webHooks = WebHooks .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val webHookEvents = WebHookEvents .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val milestones = Milestones .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val issueId = IssueId .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val issues = Issues .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val pullRequests = PullRequests .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val labels = Labels .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val issueComments = IssueComments .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val issueLabels = IssueLabels .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val commitComments = CommitComments .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val commitStatuses = CommitStatuses .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val collaborators = Collaborators .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val protectedBranches = ProtectedBranches .filter(_.byRepository(oldUserName, oldRepositoryName)).list + val protectedBranchContexts = ProtectedBranchContexts.filter(_.byRepository(oldUserName, oldRepositoryName)).list Repositories.filter { t => (t.originUserName === oldUserName.bind) && (t.originRepositoryName === oldRepositoryName.bind) @@ -92,13 +92,13 @@ } )} :_*) - PullRequests .insertAll(pullRequests .map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) - IssueComments .insertAll(issueComments .map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) - Labels .insertAll(labels .map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) - CommitComments .insertAll(commitComments.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) - CommitStatuses .insertAll(commitStatuses.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) - ProtectedBranches .insertAll(protectedBranches.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) - ProtectedBrancheContexts.insertAll(protectedBrancheContexts.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) + PullRequests .insertAll(pullRequests .map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) + IssueComments .insertAll(issueComments .map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) + Labels .insertAll(labels .map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) + CommitComments .insertAll(commitComments.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) + CommitStatuses .insertAll(commitStatuses.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) + ProtectedBranches .insertAll(protectedBranches.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) + ProtectedBranchContexts.insertAll(protectedBranchContexts.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)) :_*) // Update source repository of pull requests PullRequests.filter { t => diff --git a/src/main/twirl/gitbucket/core/settings/brancheprotection.scala.html b/src/main/twirl/gitbucket/core/settings/brancheprotection.scala.html deleted file mode 100644 index ae50111..0000000 --- a/src/main/twirl/gitbucket/core/settings/brancheprotection.scala.html +++ /dev/null @@ -1,112 +0,0 @@ -@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo, - branch: String, - protection: gitbucket.core.api.ApiBranchProtection, - knownContexts: Seq[String], - info: Option[Any])(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ -@import gitbucket.core.model.WebHook._ -@check(bool:Boolean)={@if(bool){ checked}} -@html.main(s"Branch protection for ${branch}", Some(repository)){ - @html.menu("settings", repository){ - @menu("branches", repository){ - @helper.html.information(info) -
- - } - } -} - diff --git a/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html b/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html new file mode 100644 index 0000000..ae50111 --- /dev/null +++ b/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html @@ -0,0 +1,112 @@ +@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo, + branch: String, + protection: gitbucket.core.api.ApiBranchProtection, + knownContexts: Seq[String], + info: Option[Any])(implicit context: gitbucket.core.controller.Context) +@import context._ +@import gitbucket.core.view.helpers._ +@import gitbucket.core.model.WebHook._ +@check(bool:Boolean)={@if(bool){ checked}} +@html.main(s"Branch protection for ${branch}", Some(repository)){ + @html.menu("settings", repository){ + @menu("branches", repository){ + @helper.html.information(info) + + + } + } +} +