diff --git a/src/main/resources/update/gitbucket-core_4.2.xml b/src/main/resources/update/gitbucket-core_4.2.xml new file mode 100644 index 0000000..f81e39d --- /dev/null +++ b/src/main/resources/update/gitbucket-core_4.2.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/main/scala/gitbucket/core/GitBucketCoreModule.scala b/src/main/scala/gitbucket/core/GitBucketCoreModule.scala index a276cd8..834cffe 100644 --- a/src/main/scala/gitbucket/core/GitBucketCoreModule.scala +++ b/src/main/scala/gitbucket/core/GitBucketCoreModule.scala @@ -4,9 +4,12 @@ import io.github.gitbucket.solidbase.model.{Version, Module} object GitBucketCoreModule extends Module("gitbucket-core", - new Version("4.1.0"), new Version("4.0.0", new LiquibaseMigration("update/gitbucket-core_4.0.xml"), new SqlMigration("update/gitbucket-core_4.0.sql") + ), + new Version("4.1.0"), + new Version("4.2.0", + new LiquibaseMigration("update/gitbucket-core_4.2.xml") ) ) diff --git a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala index 8a317e5..fd32311 100644 --- a/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositorySettingsController.scala @@ -27,12 +27,24 @@ with OwnerAuthenticator with UsersAuthenticator => // for repository options - case class OptionsForm(repositoryName: String, description: Option[String], isPrivate: Boolean) + case class OptionsForm( + repositoryName: String, + description: Option[String], + isPrivate: Boolean, + enableIssues: Boolean, + enableWiki: Boolean, + externalIssuesUrl: Option[String], + externalWikiUrl: Option[String] + ) val optionsForm = mapping( - "repositoryName" -> trim(label("Repository Name", text(required, maxlength(40), identifier, renameRepositoryName))), - "description" -> trim(label("Description" , optional(text()))), - "isPrivate" -> trim(label("Repository Type", boolean())) + "repositoryName" -> trim(label("Repository Name" , text(required, maxlength(40), identifier, renameRepositoryName))), + "description" -> trim(label("Description" , optional(text()))), + "isPrivate" -> trim(label("Repository Type" , boolean())), + "enableIssues" -> trim(label("Enable Issues" , boolean())), + "enableWiki" -> trim(label("Enable Wiki" , boolean())), + "externalIssuesUrl" -> trim(label("External Issues URL", optional(text(maxlength(200))))), + "externalWikiUrl" -> trim(label("External Wiki URL" , optional(text(maxlength(200))))) )(OptionsForm.apply) // for default branch @@ -92,7 +104,11 @@ form.description, repository.repository.parentUserName.map { _ => repository.repository.isPrivate - } getOrElse form.isPrivate + } getOrElse form.isPrivate, + form.enableIssues, + form.enableWiki, + form.externalIssuesUrl, + form.externalWikiUrl ) // Change repository name if(repository.name != form.repositoryName){ diff --git a/src/main/scala/gitbucket/core/model/Repository.scala b/src/main/scala/gitbucket/core/model/Repository.scala index 789f957..4012b8b 100644 --- a/src/main/scala/gitbucket/core/model/Repository.scala +++ b/src/main/scala/gitbucket/core/model/Repository.scala @@ -17,7 +17,11 @@ val originRepositoryName = column[String]("ORIGIN_REPOSITORY_NAME") val parentUserName = column[String]("PARENT_USER_NAME") val parentRepositoryName = column[String]("PARENT_REPOSITORY_NAME") - def * = (userName, repositoryName, isPrivate, description.?, defaultBranch, registeredDate, updatedDate, lastActivityDate, originUserName.?, originRepositoryName.?, parentUserName.?, parentRepositoryName.?) <> (Repository.tupled, Repository.unapply) + val enableWiki = column[Boolean]("ENABLE_WIKI") + val enableIssues = column[Boolean]("ENABLE_ISSUES") + val externalWikiUrl = column[String]("EXTERNAL_WIKI_URL") + val externalIssuesUrl = column[String]("EXTERNAL_ISSUES_URL") + def * = (userName, repositoryName, isPrivate, description.?, defaultBranch, registeredDate, updatedDate, lastActivityDate, originUserName.?, originRepositoryName.?, parentUserName.?, parentRepositoryName.?, enableWiki, enableIssues, externalWikiUrl.?, externalIssuesUrl.?) <> (Repository.tupled, Repository.unapply) def byPrimaryKey(owner: String, repository: String) = byRepository(owner, repository) } @@ -35,5 +39,9 @@ originUserName: Option[String], originRepositoryName: Option[String], parentUserName: Option[String], - parentRepositoryName: Option[String] + parentRepositoryName: Option[String], + enableWiki: Boolean, + enableIssues: Boolean, + externalWikiUrl: Option[String], + externalIssuesUrl: Option[String] ) diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 33bff37..7050436 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -36,7 +36,12 @@ originUserName = originUserName, originRepositoryName = originRepositoryName, parentUserName = parentUserName, - parentRepositoryName = parentRepositoryName) + parentRepositoryName = parentRepositoryName, + enableWiki = true, + enableIssues = true, + externalWikiUrl = None, + externalIssuesUrl = None + ) IssueId insert (userName, repositoryName, 0) } @@ -222,7 +227,7 @@ * Include public repository, private own repository and private but collaborator repository. * * @param userName the user name of collaborator - * @return the repository infomation list + * @return the repository information list */ def getAllRepositories(userName: String)(implicit s: Session): List[(String, String)] = { Repositories.filter { t1 => @@ -313,10 +318,11 @@ * Save repository options. */ def saveRepositoryOptions(userName: String, repositoryName: String, - description: Option[String], isPrivate: Boolean)(implicit s: Session): Unit = + description: Option[String], isPrivate: Boolean, enableIssues: Boolean, + enableWiki: Boolean, externalIssuesUrl: Option[String], externalWikiUrl: Option[String])(implicit s: Session): Unit = Repositories.filter(_.byRepository(userName, repositoryName)) - .map { r => (r.description.?, r.isPrivate, r.updatedDate) } - .update (description, isPrivate, currentDate) + .map { r => (r.description.?, r.isPrivate, r.enableIssues, r.enableWiki, r.externalIssuesUrl.?, r.externalWikiUrl.?, r.updatedDate) } + .update (description, isPrivate, enableIssues, enableWiki, externalIssuesUrl, externalWikiUrl, currentDate) def saveRepositoryDefaultBranch(userName: String, repositoryName: String, defaultBranch: String)(implicit s: Session): Unit = diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index 0704d03..99dbc02 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -8,15 +8,15 @@ @menuitem(path: String, name: String, label: String, icon: String, count: Int = 0) = {
  • - - - - @label - @if(count > 0){ - @count - } - - + @if(path.startsWith("http")){ + + @label @if(count > 0) { @count } + + } else { + + @label @if(count > 0) { @count } + + }
  • } @@ -44,19 +44,31 @@