mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-05 04:56:02 +01:00
Bump to sbt 1.4.6, Scala 2.13.3, and Scalatra 2.7.1 (#2609)
* Bump to sbt 1.4.6, Scala 2.13.3, and Scalatra 2.7.1 * Fix warnings in Scala 2.13
This commit is contained in:
@@ -4,7 +4,7 @@ import com.typesafe.sbt.pgp.PgpKeys._
|
||||
val Organization = "io.github.gitbucket"
|
||||
val Name = "gitbucket"
|
||||
val GitBucketVersion = "4.35.0"
|
||||
val ScalatraVersion = "2.7.0"
|
||||
val ScalatraVersion = "2.7.1"
|
||||
val JettyVersion = "9.4.32.v20200930"
|
||||
val JgitVersion = "5.9.0.202009080501-r"
|
||||
|
||||
@@ -17,7 +17,7 @@ sourcesInBase := false
|
||||
organization := Organization
|
||||
name := Name
|
||||
version := GitBucketVersion
|
||||
scalaVersion := "2.13.1"
|
||||
scalaVersion := "2.13.3"
|
||||
|
||||
scalafmtOnCompile := true
|
||||
|
||||
@@ -75,7 +75,7 @@ libraryDependencies ++= Seq(
|
||||
)
|
||||
|
||||
// Compiler settings
|
||||
scalacOptions := Seq("-deprecation", "-language:postfixOps", "-opt:l:method")
|
||||
scalacOptions := Seq("-deprecation", "-language:postfixOps", "-opt:l:method", "-feature")
|
||||
javacOptions in compile ++= Seq("-target", "8", "-source", "8")
|
||||
javaOptions in Jetty += "-Dlogback.configurationFile=/logback-dev.xml"
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
sbt.version=1.4.4
|
||||
sbt.version=1.4.6
|
||||
|
||||
@@ -421,7 +421,7 @@ trait AccountManagementControllerBase extends ControllerBase {
|
||||
"new"
|
||||
)
|
||||
|
||||
protected def reservedNames(): Constraint = new Constraint() {
|
||||
protected def reservedNames: Constraint = new Constraint() {
|
||||
override def validate(name: String, value: String, messages: Messages): Option[String] =
|
||||
if (allReservedNames.contains(value.toLowerCase)) {
|
||||
Some(s"${value} is reserved")
|
||||
|
||||
@@ -37,7 +37,7 @@ class FileUploadController
|
||||
execute(
|
||||
{ (file, fileId) =>
|
||||
FileUtils
|
||||
.writeByteArrayToFile(new File(getTemporaryDir(session.getId), FileUtil.checkFilename(fileId)), file.get)
|
||||
.writeByteArrayToFile(new File(getTemporaryDir(session.getId), FileUtil.checkFilename(fileId)), file.get())
|
||||
session += Keys.Session.Upload(fileId) -> file.name
|
||||
},
|
||||
FileUtil.isImage
|
||||
@@ -49,7 +49,7 @@ class FileUploadController
|
||||
execute(
|
||||
{ (file, fileId) =>
|
||||
FileUtils
|
||||
.writeByteArrayToFile(new File(getTemporaryDir(session.getId), FileUtil.checkFilename(fileId)), file.get)
|
||||
.writeByteArrayToFile(new File(getTemporaryDir(session.getId), FileUtil.checkFilename(fileId)), file.get())
|
||||
session += Keys.Session.Upload(fileId) -> file.name
|
||||
},
|
||||
_ => true
|
||||
@@ -65,7 +65,7 @@ class FileUploadController
|
||||
getAttachedDir(params("owner"), params("repository")),
|
||||
FileUtil.checkFilename(fileId + "." + FileUtil.getExtension(file.getName))
|
||||
),
|
||||
file.get
|
||||
file.get()
|
||||
)
|
||||
},
|
||||
_ => true
|
||||
@@ -144,7 +144,7 @@ class FileUploadController
|
||||
{ (file, fileId) =>
|
||||
FileUtils.writeByteArrayToFile(
|
||||
new File(getReleaseFilesDir(owner, repository), FileUtil.checkFilename(tag + "/" + fileId)),
|
||||
file.get
|
||||
file.get()
|
||||
)
|
||||
},
|
||||
_ => true
|
||||
|
||||
@@ -230,9 +230,9 @@ trait ApiPullRequestControllerBase extends ControllerBase {
|
||||
if (checkConflict(repository.owner, repository.name, pullReq.branch, issueId).isDefined) {
|
||||
NoContent
|
||||
} else {
|
||||
NotFound
|
||||
NotFound()
|
||||
}
|
||||
}).getOrElse(NotFound)
|
||||
}).getOrElse(NotFound())
|
||||
})
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,7 +10,7 @@ trait AccessTokenComponent { self: Profile =>
|
||||
val userName = column[String]("USER_NAME")
|
||||
val tokenHash = column[String]("TOKEN_HASH")
|
||||
val note = column[String]("NOTE")
|
||||
def * = (accessTokenId, userName, tokenHash, note) <> (AccessToken.tupled, AccessToken.unapply)
|
||||
def * = (accessTokenId, userName, tokenHash, note).<>(AccessToken.tupled, AccessToken.unapply)
|
||||
}
|
||||
}
|
||||
case class AccessToken(
|
||||
|
||||
@@ -35,7 +35,7 @@ trait AccountComponent { self: Profile =>
|
||||
groupAccount,
|
||||
removed,
|
||||
description.?
|
||||
) <> (Account.tupled, Account.unapply)
|
||||
).<>(Account.tupled, Account.unapply)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ trait AccountExtraMailAddressComponent { self: Profile =>
|
||||
val userName = column[String]("USER_NAME", O PrimaryKey)
|
||||
val extraMailAddress = column[String]("EXTRA_MAIL_ADDRESS", O PrimaryKey)
|
||||
def * =
|
||||
(userName, extraMailAddress) <> (AccountExtraMailAddress.tupled, AccountExtraMailAddress.unapply)
|
||||
(userName, extraMailAddress).<>(AccountExtraMailAddress.tupled, AccountExtraMailAddress.unapply)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ trait AccountFederationComponent { self: Profile =>
|
||||
val issuer = column[String]("ISSUER")
|
||||
val subject = column[String]("SUBJECT")
|
||||
val userName = column[String]("USER_NAME")
|
||||
def * = (issuer, subject, userName) <> (AccountFederation.tupled, AccountFederation.unapply)
|
||||
def * = (issuer, subject, userName).<>(AccountFederation.tupled, AccountFederation.unapply)
|
||||
|
||||
def byPrimaryKey(issuer: String, subject: String): Rep[Boolean] =
|
||||
(this.issuer === issuer.bind) && (this.subject === subject.bind)
|
||||
|
||||
@@ -9,7 +9,7 @@ trait AccountPreferenceComponent { self: Profile =>
|
||||
val userName = column[String]("USER_NAME", O PrimaryKey)
|
||||
val highlighterTheme = column[String]("HIGHLIGHTER_THEME")
|
||||
def * =
|
||||
(userName, highlighterTheme) <> (AccountPreference.tupled, AccountPreference.unapply)
|
||||
(userName, highlighterTheme).<>(AccountPreference.tupled, AccountPreference.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String): Rep[Boolean] = this.userName === userName.bind
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ trait AccountWebHookComponent extends TemplateComponent { self: Profile =>
|
||||
val url = column[String]("URL")
|
||||
val token = column[Option[String]]("TOKEN")
|
||||
val ctype = column[WebHookContentType]("CTYPE")
|
||||
def * = (userName, url, ctype, token) <> ((AccountWebHook.apply _).tupled, AccountWebHook.unapply)
|
||||
def * = (userName, url, ctype, token).<>((AccountWebHook.apply _).tupled, AccountWebHook.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String, url: String) = (this.userName === userName.bind) && (this.url === url.bind)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ trait AccountWebHookEventComponent extends TemplateComponent {
|
||||
val url = column[String]("URL")
|
||||
val event = column[WebHook.Event]("EVENT")
|
||||
|
||||
def * = (userName, url, event) <> ((AccountWebHookEvent.apply _).tupled, AccountWebHookEvent.unapply)
|
||||
def * = (userName, url, event).<>((AccountWebHookEvent.apply _).tupled, AccountWebHookEvent.unapply)
|
||||
|
||||
def byAccountWebHook(userName: String, url: String) = (this.userName === userName.bind) && (this.url === url.bind)
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package gitbucket.core.model
|
||||
|
||||
/**
|
||||
* ActivityComponent has been deprecated, but keep it for binary compatibility.
|
||||
*/
|
||||
@deprecated("ActivityComponent has been deprecated, but keep it for binary compatibility.", "4.34.0")
|
||||
trait ActivityComponent extends TemplateComponent { self: Profile =>
|
||||
import profile.api._
|
||||
import self._
|
||||
// /**
|
||||
// * ActivityComponent has been deprecated, but keep it for binary compatibility.
|
||||
// */
|
||||
// @deprecated("ActivityComponent has been deprecated, but keep it for binary compatibility.", "4.34.0")
|
||||
// trait ActivityComponent extends TemplateComponent { self: Profile =>
|
||||
// import profile.api._
|
||||
// import self._
|
||||
|
||||
lazy val Activities = TableQuery[Activities]
|
||||
// lazy val Activities = TableQuery[Activities]
|
||||
|
||||
class Activities(tag: Tag) extends Table[Activity](tag, "ACTIVITY") with BasicTemplate {
|
||||
def * = ???
|
||||
}
|
||||
}
|
||||
// class Activities(tag: Tag) extends Table[Activity](tag, "ACTIVITY") with BasicTemplate {
|
||||
// def * = ???
|
||||
// }
|
||||
// }
|
||||
|
||||
case class Activity(
|
||||
userName: String,
|
||||
|
||||
@@ -8,7 +8,7 @@ trait CollaboratorComponent extends TemplateComponent { self: Profile =>
|
||||
class Collaborators(tag: Tag) extends Table[Collaborator](tag, "COLLABORATOR") with BasicTemplate {
|
||||
val collaboratorName = column[String]("COLLABORATOR_NAME")
|
||||
val role = column[String]("ROLE")
|
||||
def * = (userName, repositoryName, collaboratorName, role) <> (Collaborator.tupled, Collaborator.unapply)
|
||||
def * = (userName, repositoryName, collaboratorName, role).<>(Collaborator.tupled, Collaborator.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, collaborator: String) =
|
||||
byRepository(owner, repository) && (collaboratorName === collaborator.bind)
|
||||
|
||||
@@ -20,7 +20,8 @@ trait IssueCommentComponent extends TemplateComponent { self: Profile =>
|
||||
val registeredDate = column[java.util.Date]("REGISTERED_DATE")
|
||||
val updatedDate = column[java.util.Date]("UPDATED_DATE")
|
||||
def * =
|
||||
(userName, repositoryName, issueId, commentId, action, commentedUserName, content, registeredDate, updatedDate) <> (IssueComment.tupled, IssueComment.unapply)
|
||||
(userName, repositoryName, issueId, commentId, action, commentedUserName, content, registeredDate, updatedDate)
|
||||
.<>(IssueComment.tupled, IssueComment.unapply)
|
||||
|
||||
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
|
||||
}
|
||||
@@ -74,7 +75,7 @@ trait CommitCommentComponent extends TemplateComponent { self: Profile =>
|
||||
originalCommitId,
|
||||
originalOldLine,
|
||||
originalNewLine
|
||||
) <> (CommitComment.tupled, CommitComment.unapply)
|
||||
).<>(CommitComment.tupled, CommitComment.unapply)
|
||||
|
||||
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ trait CommitStatusComponent extends TemplateComponent { self: Profile =>
|
||||
creator,
|
||||
registeredDate,
|
||||
updatedDate
|
||||
) <> ((CommitStatus.apply _).tupled, CommitStatus.unapply)
|
||||
).<>((CommitStatus.apply _).tupled, CommitStatus.unapply)
|
||||
def byPrimaryKey(id: Int) = commitStatusId === id.bind
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ trait DeployKeyComponent extends TemplateComponent { self: Profile =>
|
||||
val publicKey = column[String]("PUBLIC_KEY")
|
||||
val allowWrite = column[Boolean]("ALLOW_WRITE")
|
||||
def * =
|
||||
(userName, repositoryName, deployKeyId, title, publicKey, allowWrite) <> (DeployKey.tupled, DeployKey.unapply)
|
||||
(userName, repositoryName, deployKeyId, title, publicKey, allowWrite).<>(DeployKey.tupled, DeployKey.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String, repositoryName: String, deployKeyId: Int) =
|
||||
(this.userName === userName.bind) && (this.repositoryName === repositoryName.bind) && (this.deployKeyId === deployKeyId.bind)
|
||||
|
||||
@@ -11,7 +11,7 @@ trait GpgKeyComponent { self: Profile =>
|
||||
val gpgKeyId = column[Long]("GPG_KEY_ID")
|
||||
val title = column[String]("TITLE")
|
||||
val publicKey = column[String]("PUBLIC_KEY")
|
||||
def * = (userName, keyId, gpgKeyId, title, publicKey) <> (GpgKey.tupled, GpgKey.unapply)
|
||||
def * = (userName, keyId, gpgKeyId, title, publicKey).<>(GpgKey.tupled, GpgKey.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String, keyId: Int) =
|
||||
(this.userName === userName.bind) && (this.keyId === keyId.bind)
|
||||
|
||||
@@ -9,7 +9,7 @@ trait GroupMemberComponent { self: Profile =>
|
||||
val groupName = column[String]("GROUP_NAME", O PrimaryKey)
|
||||
val userName = column[String]("USER_NAME", O PrimaryKey)
|
||||
val isManager = column[Boolean]("MANAGER")
|
||||
def * = (groupName, userName, isManager) <> (GroupMember.tupled, GroupMember.unapply)
|
||||
def * = (groupName, userName, isManager).<>(GroupMember.tupled, GroupMember.unapply)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ trait IssueComponent extends TemplateComponent { self: Profile =>
|
||||
registeredDate,
|
||||
updatedDate,
|
||||
pullRequest
|
||||
) <> (Issue.tupled, Issue.unapply)
|
||||
).<>(Issue.tupled, Issue.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, issueId: Int) = byIssue(owner, repository, issueId)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ trait IssueLabelComponent extends TemplateComponent { self: Profile =>
|
||||
lazy val IssueLabels = TableQuery[IssueLabels]
|
||||
|
||||
class IssueLabels(tag: Tag) extends Table[IssueLabel](tag, "ISSUE_LABEL") with IssueTemplate with LabelTemplate {
|
||||
def * = (userName, repositoryName, issueId, labelId) <> (IssueLabel.tupled, IssueLabel.unapply)
|
||||
def * = (userName, repositoryName, issueId, labelId).<>(IssueLabel.tupled, IssueLabel.unapply)
|
||||
def byPrimaryKey(owner: String, repository: String, issueId: Int, labelId: Int) =
|
||||
byIssue(owner, repository, issueId) && (this.labelId === labelId.bind)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ trait LabelComponent extends TemplateComponent { self: Profile =>
|
||||
override val labelId = column[Int]("LABEL_ID", O AutoInc)
|
||||
override val labelName = column[String]("LABEL_NAME")
|
||||
val color = column[String]("COLOR")
|
||||
def * = (userName, repositoryName, labelId, labelName, color) <> (Label.tupled, Label.unapply)
|
||||
def * = (userName, repositoryName, labelId, labelName, color).<>(Label.tupled, Label.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, labelId: Int) = byLabel(owner, repository, labelId)
|
||||
def byPrimaryKey(userName: Rep[String], repositoryName: Rep[String], labelId: Rep[Int]) =
|
||||
|
||||
@@ -13,7 +13,8 @@ trait MilestoneComponent extends TemplateComponent { self: Profile =>
|
||||
val dueDate = column[Option[java.util.Date]]("DUE_DATE")
|
||||
val closedDate = column[Option[java.util.Date]]("CLOSED_DATE")
|
||||
def * =
|
||||
(userName, repositoryName, milestoneId, title, description, dueDate, closedDate) <> (Milestone.tupled, Milestone.unapply)
|
||||
(userName, repositoryName, milestoneId, title, description, dueDate, closedDate)
|
||||
.<>(Milestone.tupled, Milestone.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, milestoneId: Int) = byMilestone(owner, repository, milestoneId)
|
||||
def byPrimaryKey(userName: Rep[String], repositoryName: Rep[String], milestoneId: Rep[Int]) =
|
||||
|
||||
@@ -13,7 +13,8 @@ trait PriorityComponent extends TemplateComponent { self: Profile =>
|
||||
val isDefault = column[Boolean]("IS_DEFAULT")
|
||||
val color = column[String]("COLOR")
|
||||
def * =
|
||||
(userName, repositoryName, priorityId, priorityName, description.?, isDefault, ordering, color) <> (Priority.tupled, Priority.unapply)
|
||||
(userName, repositoryName, priorityId, priorityName, description.?, isDefault, ordering, color)
|
||||
.<>(Priority.tupled, Priority.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, priorityId: Int) = byPriority(owner, repository, priorityId)
|
||||
def byPrimaryKey(userName: Rep[String], repositoryName: Rep[String], priorityId: Rep[Int]) =
|
||||
|
||||
@@ -45,7 +45,6 @@ trait CoreProfile
|
||||
with Profile
|
||||
with AccessTokenComponent
|
||||
with AccountComponent
|
||||
with ActivityComponent // ActivityComponent has been deprecated, but keep it for binary compatibility
|
||||
with CollaboratorComponent
|
||||
with CommitCommentComponent
|
||||
with CommitStatusComponent
|
||||
|
||||
@@ -7,7 +7,7 @@ trait ProtectedBranchComponent extends TemplateComponent { self: Profile =>
|
||||
lazy val ProtectedBranches = TableQuery[ProtectedBranches]
|
||||
class ProtectedBranches(tag: Tag) extends Table[ProtectedBranch](tag, "PROTECTED_BRANCH") with BranchTemplate {
|
||||
val statusCheckAdmin = column[Boolean]("STATUS_CHECK_ADMIN")
|
||||
def * = (userName, repositoryName, branch, statusCheckAdmin) <> (ProtectedBranch.tupled, ProtectedBranch.unapply)
|
||||
def * = (userName, repositoryName, branch, statusCheckAdmin).<>(ProtectedBranch.tupled, ProtectedBranch.unapply)
|
||||
def byPrimaryKey(userName: String, repositoryName: String, branch: String) =
|
||||
byBranch(userName, repositoryName, branch)
|
||||
def byPrimaryKey(userName: Rep[String], repositoryName: Rep[String], branch: Rep[String]) =
|
||||
@@ -20,7 +20,7 @@ trait ProtectedBranchComponent extends TemplateComponent { self: Profile =>
|
||||
with BranchTemplate {
|
||||
val context = column[String]("CONTEXT")
|
||||
def * =
|
||||
(userName, repositoryName, branch, context) <> (ProtectedBranchContext.tupled, ProtectedBranchContext.unapply)
|
||||
(userName, repositoryName, branch, context).<>(ProtectedBranchContext.tupled, ProtectedBranchContext.unapply)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ trait PullRequestComponent extends TemplateComponent { self: Profile =>
|
||||
commitIdFrom,
|
||||
commitIdTo,
|
||||
isDraft
|
||||
) <> (PullRequest.tupled, PullRequest.unapply)
|
||||
).<>(PullRequest.tupled, PullRequest.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String, repositoryName: String, issueId: Int) =
|
||||
byIssue(userName, repositoryName, issueId)
|
||||
|
||||
@@ -21,7 +21,8 @@ trait ReleaseAssetComponent extends TemplateComponent {
|
||||
val updatedDate = column[Date]("UPDATED_DATE")
|
||||
|
||||
def * =
|
||||
(userName, repositoryName, tag, releaseAssetId, fileName, label, size, uploader, registeredDate, updatedDate) <> (ReleaseAsset.tupled, ReleaseAsset.unapply)
|
||||
(userName, repositoryName, tag, releaseAssetId, fileName, label, size, uploader, registeredDate, updatedDate)
|
||||
.<>(ReleaseAsset.tupled, ReleaseAsset.unapply)
|
||||
def byPrimaryKey(owner: String, repository: String, tag: String, fileName: String) =
|
||||
byTag(owner, repository, tag) && (this.fileName === fileName.bind)
|
||||
def byTag(owner: String, repository: String, tag: String) =
|
||||
|
||||
@@ -17,7 +17,8 @@ trait ReleaseTagComponent extends TemplateComponent {
|
||||
val updatedDate = column[java.util.Date]("UPDATED_DATE")
|
||||
|
||||
def * =
|
||||
(userName, repositoryName, name, tag, author, content, registeredDate, updatedDate) <> (ReleaseTag.tupled, ReleaseTag.unapply)
|
||||
(userName, repositoryName, name, tag, author, content, registeredDate, updatedDate)
|
||||
.<>(ReleaseTag.tupled, ReleaseTag.unapply)
|
||||
def byPrimaryKey(owner: String, repository: String, tag: String) = byTag(owner, repository, tag)
|
||||
def byTag(owner: String, repository: String, tag: String) =
|
||||
byRepository(owner, repository) && (this.tag === tag.bind)
|
||||
|
||||
@@ -42,46 +42,48 @@ trait RepositoryComponent extends TemplateComponent { self: Profile =>
|
||||
parentRepositoryName.?
|
||||
),
|
||||
(issuesOption, externalIssuesUrl.?, wikiOption, externalWikiUrl.?, allowFork, mergeOptions, defaultMergeOption)
|
||||
).shaped <> ({
|
||||
case (repository, options) =>
|
||||
Repository(
|
||||
repository._1,
|
||||
repository._2,
|
||||
repository._3,
|
||||
repository._4,
|
||||
repository._5,
|
||||
repository._6,
|
||||
repository._7,
|
||||
repository._8,
|
||||
repository._9,
|
||||
repository._10,
|
||||
repository._11,
|
||||
repository._12,
|
||||
RepositoryOptions.tupled.apply(options)
|
||||
)
|
||||
}, { (r: Repository) =>
|
||||
Some(
|
||||
(
|
||||
).shaped.<>(
|
||||
{
|
||||
case (repository, options) =>
|
||||
Repository(
|
||||
repository._1,
|
||||
repository._2,
|
||||
repository._3,
|
||||
repository._4,
|
||||
repository._5,
|
||||
repository._6,
|
||||
repository._7,
|
||||
repository._8,
|
||||
repository._9,
|
||||
repository._10,
|
||||
repository._11,
|
||||
repository._12,
|
||||
RepositoryOptions.tupled.apply(options)
|
||||
)
|
||||
}, { (r: Repository) =>
|
||||
Some(
|
||||
(
|
||||
r.userName,
|
||||
r.repositoryName,
|
||||
r.isPrivate,
|
||||
r.description,
|
||||
r.defaultBranch,
|
||||
r.registeredDate,
|
||||
r.updatedDate,
|
||||
r.lastActivityDate,
|
||||
r.originUserName,
|
||||
r.originRepositoryName,
|
||||
r.parentUserName,
|
||||
r.parentRepositoryName
|
||||
),
|
||||
(
|
||||
RepositoryOptions.unapply(r.options).get
|
||||
(
|
||||
r.userName,
|
||||
r.repositoryName,
|
||||
r.isPrivate,
|
||||
r.description,
|
||||
r.defaultBranch,
|
||||
r.registeredDate,
|
||||
r.updatedDate,
|
||||
r.lastActivityDate,
|
||||
r.originUserName,
|
||||
r.originRepositoryName,
|
||||
r.parentUserName,
|
||||
r.parentRepositoryName
|
||||
),
|
||||
(
|
||||
RepositoryOptions.unapply(r.options).get
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String) = byRepository(owner, repository)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ trait RepositoryWebHookComponent extends TemplateComponent { self: Profile =>
|
||||
val token = column[Option[String]]("TOKEN")
|
||||
val ctype = column[WebHookContentType]("CTYPE")
|
||||
def * =
|
||||
(userName, repositoryName, hookId, url, ctype, token) <> ((RepositoryWebHook.apply _).tupled, RepositoryWebHook.unapply)
|
||||
(userName, repositoryName, hookId, url, ctype, token)
|
||||
.<>((RepositoryWebHook.apply _).tupled, RepositoryWebHook.unapply)
|
||||
|
||||
def byRepositoryUrl(owner: String, repository: String, url: String) =
|
||||
byRepository(owner, repository) && (this.url === url.bind)
|
||||
|
||||
@@ -12,7 +12,7 @@ trait RepositoryWebHookEventComponent extends TemplateComponent { self: Profile
|
||||
val url = column[String]("URL")
|
||||
val event = column[WebHook.Event]("EVENT")
|
||||
def * =
|
||||
(userName, repositoryName, url, event) <> ((RepositoryWebHookEvent.apply _).tupled, RepositoryWebHookEvent.unapply)
|
||||
(userName, repositoryName, url, event).<>((RepositoryWebHookEvent.apply _).tupled, RepositoryWebHookEvent.unapply)
|
||||
|
||||
def byRepositoryWebHook(owner: String, repository: String, url: String) =
|
||||
byRepository(owner, repository) && (this.url === url.bind)
|
||||
|
||||
@@ -10,7 +10,7 @@ trait SshKeyComponent { self: Profile =>
|
||||
val sshKeyId = column[Int]("SSH_KEY_ID", O AutoInc)
|
||||
val title = column[String]("TITLE")
|
||||
val publicKey = column[String]("PUBLIC_KEY")
|
||||
def * = (userName, sshKeyId, title, publicKey) <> (SshKey.tupled, SshKey.unapply)
|
||||
def * = (userName, sshKeyId, title, publicKey).<>(SshKey.tupled, SshKey.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String, sshKeyId: Int) =
|
||||
(this.userName === userName.bind) && (this.sshKeyId === sshKeyId.bind)
|
||||
|
||||
@@ -105,13 +105,13 @@ trait AccountService {
|
||||
}
|
||||
|
||||
def getAccountByUserName(userName: String, includeRemoved: Boolean = false)(implicit s: Session): Option[Account] =
|
||||
Accounts filter (t => (t.userName === userName.bind) && (t.removed === false.bind, !includeRemoved)) firstOption
|
||||
Accounts filter (t => (t.userName === userName.bind).&&(t.removed === false.bind, !includeRemoved)) firstOption
|
||||
|
||||
def getAccountByUserNameIgnoreCase(userName: String, includeRemoved: Boolean = false)(
|
||||
implicit s: Session
|
||||
): Option[Account] =
|
||||
Accounts filter (
|
||||
t => (t.userName.toLowerCase === userName.toLowerCase.bind) && (t.removed === false.bind, !includeRemoved)
|
||||
t => (t.userName.toLowerCase === userName.toLowerCase.bind).&&(t.removed === false.bind, !includeRemoved)
|
||||
) firstOption
|
||||
|
||||
def getAccountsByUserNames(userNames: Set[String], knowns: Set[Account], includeRemoved: Boolean = false)(
|
||||
@@ -123,7 +123,7 @@ trait AccountService {
|
||||
map
|
||||
} else {
|
||||
map ++ Accounts
|
||||
.filter(t => (t.userName inSetBind needs) && (t.removed === false.bind, !includeRemoved))
|
||||
.filter(t => (t.userName inSetBind needs).&&(t.removed === false.bind, !includeRemoved))
|
||||
.list
|
||||
.map(a => a.userName -> a)
|
||||
.toMap
|
||||
@@ -140,15 +140,15 @@ trait AccountService {
|
||||
(x.map { e =>
|
||||
e.extraMailAddress.toLowerCase === mailAddress.toLowerCase.bind
|
||||
}
|
||||
.getOrElse(false.bind))) && (a.removed === false.bind, !includeRemoved)
|
||||
.getOrElse(false.bind))).&&(a.removed === false.bind, !includeRemoved)
|
||||
}
|
||||
.map { case (a, e) => a } firstOption
|
||||
|
||||
def getAllUsers(includeRemoved: Boolean = true, includeGroups: Boolean = true)(implicit s: Session): List[Account] = {
|
||||
Accounts filter { t =>
|
||||
(1.bind === 1.bind) &&
|
||||
(t.groupAccount === false.bind, !includeGroups) &&
|
||||
(t.removed === false.bind, !includeRemoved)
|
||||
(1.bind === 1.bind)
|
||||
.&&(t.groupAccount === false.bind, !includeGroups)
|
||||
.&&(t.removed === false.bind, !includeRemoved)
|
||||
} sortBy (_.userName) list
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ trait ActivityService {
|
||||
}
|
||||
}
|
||||
|
||||
def recordActivity[T <: { def toActivity: Activity }](info: T): Unit =
|
||||
def recordActivity[T <: { def toActivity: Activity }](info: T): Unit = {
|
||||
import scala.language.reflectiveCalls
|
||||
writeLog(info.toActivity)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,49 +351,64 @@ trait IssuesService {
|
||||
} else {
|
||||
((t1.userName ++ "/" ++ t1.repositoryName) inSetBind (repos.map { case (owner, repo) => s"$owner/$repo" }))
|
||||
}) &&
|
||||
(t1.closed === (condition.state == "closed").bind) &&
|
||||
(t1.milestoneId.? isEmpty, condition.milestone == Some(None)) &&
|
||||
(t1.priorityId.? isEmpty, condition.priority == Some(None)) &&
|
||||
(t1.assignedUserName.? isEmpty, condition.assigned == Some(None)) &&
|
||||
(t1.openedUserName === condition.author.get.bind, condition.author.isDefined) &&
|
||||
(t1.closed === (condition.state == "closed").bind)
|
||||
.&&(t1.milestoneId.? isEmpty, condition.milestone == Some(None))
|
||||
.&&(t1.priorityId.? isEmpty, condition.priority == Some(None))
|
||||
.&&(t1.assignedUserName.? isEmpty, condition.assigned == Some(None))
|
||||
.&&(t1.openedUserName === condition.author.get.bind, condition.author.isDefined) &&
|
||||
(searchOption match {
|
||||
case IssueSearchOption.Issues => t1.pullRequest === false
|
||||
case IssueSearchOption.PullRequests => t1.pullRequest === true
|
||||
case IssueSearchOption.Both => t1.pullRequest === false || t1.pullRequest === true
|
||||
}) &&
|
||||
})
|
||||
// Milestone filter
|
||||
(Milestones filter { t2 =>
|
||||
(t2.byPrimaryKey(t1.userName, t1.repositoryName, t1.milestoneId)) &&
|
||||
(t2.title === condition.milestone.get.get.bind)
|
||||
} exists, condition.milestone.flatten.isDefined) &&
|
||||
// Priority filter
|
||||
(Priorities filter { t2 =>
|
||||
(t2.byPrimaryKey(t1.userName, t1.repositoryName, t1.priorityId)) &&
|
||||
(t2.priorityName === condition.priority.get.get.bind)
|
||||
} exists, condition.priority.flatten.isDefined) &&
|
||||
// Assignee filter
|
||||
(t1.assignedUserName === condition.assigned.get.get.bind, condition.assigned.flatten.isDefined) &&
|
||||
// Label filter
|
||||
(IssueLabels filter { t2 =>
|
||||
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) &&
|
||||
(t2.labelId in
|
||||
(Labels filter { t3 =>
|
||||
(t3.byRepository(t1.userName, t1.repositoryName)) &&
|
||||
(t3.labelName inSetBind condition.labels)
|
||||
} map (_.labelId)))
|
||||
} exists, condition.labels.nonEmpty) &&
|
||||
// Visibility filter
|
||||
(Repositories filter { t2 =>
|
||||
(t2.byRepository(t1.userName, t1.repositoryName)) &&
|
||||
(t2.isPrivate === (condition.visibility == Some("private")).bind)
|
||||
} exists, condition.visibility.nonEmpty) &&
|
||||
// Organization (group) filter
|
||||
(t1.userName inSetBind condition.groups, condition.groups.nonEmpty) &&
|
||||
// Mentioned filter
|
||||
((t1.openedUserName === condition.mentioned.get.bind) || t1.assignedUserName === condition.mentioned.get.bind ||
|
||||
(IssueComments filter { t2 =>
|
||||
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) && (t2.commentedUserName === condition.mentioned.get.bind)
|
||||
} exists), condition.mentioned.isDefined)
|
||||
.&&(
|
||||
Milestones filter { t2 =>
|
||||
(t2.byPrimaryKey(t1.userName, t1.repositoryName, t1.milestoneId)) &&
|
||||
(t2.title === condition.milestone.get.get.bind)
|
||||
} exists,
|
||||
condition.milestone.flatten.isDefined
|
||||
)
|
||||
// Priority filter
|
||||
.&&(
|
||||
Priorities filter { t2 =>
|
||||
(t2.byPrimaryKey(t1.userName, t1.repositoryName, t1.priorityId)) &&
|
||||
(t2.priorityName === condition.priority.get.get.bind)
|
||||
} exists,
|
||||
condition.priority.flatten.isDefined
|
||||
)
|
||||
// Assignee filter
|
||||
.&&(t1.assignedUserName === condition.assigned.get.get.bind, condition.assigned.flatten.isDefined)
|
||||
// Label filter
|
||||
.&&(
|
||||
IssueLabels filter { t2 =>
|
||||
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) &&
|
||||
(t2.labelId in
|
||||
(Labels filter { t3 =>
|
||||
(t3.byRepository(t1.userName, t1.repositoryName)) &&
|
||||
(t3.labelName inSetBind condition.labels)
|
||||
} map (_.labelId)))
|
||||
} exists,
|
||||
condition.labels.nonEmpty
|
||||
)
|
||||
// Visibility filter
|
||||
.&&(
|
||||
Repositories filter { t2 =>
|
||||
(t2.byRepository(t1.userName, t1.repositoryName)) &&
|
||||
(t2.isPrivate === (condition.visibility == Some("private")).bind)
|
||||
} exists,
|
||||
condition.visibility.nonEmpty
|
||||
)
|
||||
// Organization (group) filter
|
||||
.&&(t1.userName inSetBind condition.groups, condition.groups.nonEmpty)
|
||||
// Mentioned filter
|
||||
.&&(
|
||||
(t1.openedUserName === condition.mentioned.get.bind) || t1.assignedUserName === condition.mentioned.get.bind ||
|
||||
(IssueComments filter { t2 =>
|
||||
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) && (t2.commentedUserName === condition.mentioned.get.bind)
|
||||
} exists),
|
||||
condition.mentioned.isDefined
|
||||
)
|
||||
}
|
||||
|
||||
def insertIssue(
|
||||
@@ -692,8 +707,8 @@ trait IssuesService {
|
||||
case (t1, t2) =>
|
||||
keywords
|
||||
.map { keyword =>
|
||||
(t1.title.toLowerCase like (s"%${likeEncode(keyword)}%", '^')) ||
|
||||
(t1.content.toLowerCase like (s"%${likeEncode(keyword)}%", '^'))
|
||||
(t1.title.toLowerCase.like(s"%${likeEncode(keyword)}%", '^')) ||
|
||||
(t1.content.toLowerCase.like(s"%${likeEncode(keyword)}%", '^'))
|
||||
}
|
||||
.reduceLeft(_ && _)
|
||||
}
|
||||
@@ -720,7 +735,7 @@ trait IssuesService {
|
||||
t2.pullRequest === pullRequest.bind &&
|
||||
keywords
|
||||
.map { query =>
|
||||
t1.content.toLowerCase like (s"%${likeEncode(query)}%", '^')
|
||||
t1.content.toLowerCase.like(s"%${likeEncode(query)}%", '^')
|
||||
}
|
||||
.reduceLeft(_ && _)
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ object MergeService {
|
||||
}
|
||||
|
||||
def checkConflict(): Option[String] = {
|
||||
checkConflictCache.getOrElse(checkConflictForce)
|
||||
checkConflictCache().getOrElse(checkConflictForce())
|
||||
}
|
||||
|
||||
def checkConflictForce(): Option[String] = {
|
||||
|
||||
@@ -77,9 +77,9 @@ trait PullRequestService {
|
||||
}
|
||||
.filter {
|
||||
case (t1, t2) =>
|
||||
(t2.closed === closed.bind) &&
|
||||
(t1.userName === owner.get.bind, owner.isDefined) &&
|
||||
(t1.repositoryName === repository.get.bind, repository.isDefined)
|
||||
(t2.closed === closed.bind)
|
||||
.&&(t1.userName === owner.get.bind, owner.isDefined)
|
||||
.&&(t1.repositoryName === repository.get.bind, repository.isDefined)
|
||||
}
|
||||
.groupBy { case (t1, t2) => t2.openedUserName }
|
||||
.map { case (userName, t) => userName -> t.length }
|
||||
@@ -183,10 +183,10 @@ trait PullRequestService {
|
||||
}
|
||||
.filter {
|
||||
case (t1, t2) =>
|
||||
(t1.requestUserName === userName.bind) &&
|
||||
(t1.requestRepositoryName === repositoryName.bind) &&
|
||||
(t1.requestBranch === branch.bind) &&
|
||||
(t2.closed === closed.get.bind, closed.isDefined)
|
||||
(t1.requestUserName === userName.bind)
|
||||
.&&(t1.requestRepositoryName === repositoryName.bind)
|
||||
.&&(t1.requestBranch === branch.bind)
|
||||
.&&(t2.closed === closed.get.bind, closed.isDefined)
|
||||
}
|
||||
.map { case (t1, t2) => t1 }
|
||||
.list
|
||||
@@ -201,10 +201,10 @@ trait PullRequestService {
|
||||
}
|
||||
.filter {
|
||||
case (t1, t2) =>
|
||||
(t1.requestUserName === userName.bind) &&
|
||||
(t1.requestRepositoryName === repositoryName.bind) &&
|
||||
(t1.branch === branch.bind) &&
|
||||
(t2.closed === closed.get.bind, closed.isDefined)
|
||||
(t1.requestUserName === userName.bind)
|
||||
.&&(t1.requestRepositoryName === repositoryName.bind)
|
||||
.&&(t1.branch === branch.bind)
|
||||
.&&(t2.closed === closed.get.bind, closed.isDefined)
|
||||
}
|
||||
.map { case (t1, t2) => t1 }
|
||||
.list
|
||||
|
||||
@@ -283,7 +283,7 @@ trait WebHookService {
|
||||
val json = JsonFormat(payload)
|
||||
|
||||
webHooks.map { webHook =>
|
||||
val reqPromise = Promise[HttpRequest]
|
||||
val reqPromise = Promise[HttpRequest]()
|
||||
val f = Future {
|
||||
val itcp = new org.apache.http.HttpRequestInterceptor {
|
||||
def process(res: HttpRequest, ctx: HttpContext): Unit = {
|
||||
|
||||
@@ -202,7 +202,7 @@ object JDBCUtil {
|
||||
}
|
||||
|
||||
private def allTablesOrderByDependencies(meta: DatabaseMetaData): Seq[String] = {
|
||||
val tables = allTableNames.map { tableName =>
|
||||
val tables = allTableNames().map { tableName =>
|
||||
TableDependency(tableName, childTables(meta, tableName))
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@ object LDAPUtil {
|
||||
}
|
||||
|
||||
private def getSslProvider(): Provider = {
|
||||
import scala.language.existentials
|
||||
|
||||
val cachedInstance = provider.get()
|
||||
if (cachedInstance == null) {
|
||||
val cls = try {
|
||||
|
||||
@@ -71,7 +71,7 @@ class AccessTokenServiceSpec extends AnyFunSuite with ServiceSpecBase {
|
||||
withTestDB { implicit session =>
|
||||
val tokenIt = List("token1", "token1", "token1", "token2").iterator
|
||||
val service = new AccessTokenService {
|
||||
override def makeAccessTokenString: String = tokenIt.next
|
||||
override def makeAccessTokenString: String = tokenIt.next()
|
||||
}
|
||||
|
||||
assert(service.generateAccessToken("root", "note1")._2 == "token1")
|
||||
|
||||
Reference in New Issue
Block a user