mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-02 11:36:05 +01:00
Merge branch 'scala-2.11'
This commit is contained in:
@@ -8,8 +8,8 @@ object MyBuild extends Build {
|
||||
val Organization = "jp.sf.amateras"
|
||||
val Name = "gitbucket"
|
||||
val Version = "0.0.1"
|
||||
val ScalaVersion = "2.10.3"
|
||||
val ScalatraVersion = "2.2.1"
|
||||
val ScalaVersion = "2.11.2"
|
||||
val ScalatraVersion = "2.3.0"
|
||||
|
||||
lazy val project = Project (
|
||||
"gitbucket",
|
||||
@@ -31,15 +31,15 @@ object MyBuild extends Build {
|
||||
"org.scalatra" %% "scalatra" % ScalatraVersion,
|
||||
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
|
||||
"org.scalatra" %% "scalatra-json" % ScalatraVersion,
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.5",
|
||||
"jp.sf.amateras" %% "scalatra-forms" % "0.0.14",
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.10",
|
||||
"jp.sf.amateras" %% "scalatra-forms" % "0.1.0",
|
||||
"commons-io" % "commons-io" % "2.4",
|
||||
"org.pegdown" % "pegdown" % "1.4.1",
|
||||
"org.apache.commons" % "commons-compress" % "1.5",
|
||||
"org.apache.commons" % "commons-email" % "1.3.1",
|
||||
"org.apache.httpcomponents" % "httpclient" % "4.3",
|
||||
"org.apache.sshd" % "apache-sshd" % "0.11.0",
|
||||
"com.typesafe.slick" %% "slick" % "2.0.2",
|
||||
"com.typesafe.slick" %% "slick" % "2.1.0-RC3",
|
||||
"org.mozilla" % "rhino" % "1.7R4",
|
||||
"com.novell.ldap" % "jldap" % "2009-10-07",
|
||||
"org.quartz-scheduler" % "quartz" % "2.2.1",
|
||||
|
||||
@@ -24,8 +24,9 @@ abstract class ControllerBase extends ScalatraFilter
|
||||
|
||||
implicit val jsonFormats = DefaultFormats
|
||||
|
||||
// Don't set content type via Accept header.
|
||||
override def format(implicit request: HttpServletRequest) = ""
|
||||
// TODO Scala 2.11
|
||||
// // Don't set content type via Accept header.
|
||||
// override def format(implicit request: HttpServletRequest) = ""
|
||||
|
||||
override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain): Unit = try {
|
||||
val httpRequest = request.asInstanceOf[HttpServletRequest]
|
||||
@@ -125,11 +126,13 @@ abstract class ControllerBase extends ScalatraFilter
|
||||
}
|
||||
}
|
||||
|
||||
override def fullUrl(path: String, params: Iterable[(String, Any)] = Iterable.empty,
|
||||
includeContextPath: Boolean = true, includeServletPath: Boolean = true)
|
||||
(implicit request: HttpServletRequest, response: HttpServletResponse) =
|
||||
// TODO Scala 2.11
|
||||
override def url(path: String, params: Iterable[(String, Any)] = Iterable.empty,
|
||||
includeContextPath: Boolean = true, includeServletPath: Boolean = true,
|
||||
absolutize: Boolean = true, withSessionId: Boolean = true)
|
||||
(implicit request: HttpServletRequest, response: HttpServletResponse): String =
|
||||
if (path.startsWith("http")) path
|
||||
else baseUrl + url(path, params, false, false, false)
|
||||
else baseUrl + super.url(path, params, false, false, false)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,40 +8,40 @@ protected[model] trait TemplateComponent { self: Profile =>
|
||||
val repositoryName = column[String]("REPOSITORY_NAME")
|
||||
|
||||
def byRepository(owner: String, repository: String) =
|
||||
(userName is owner.bind) && (repositoryName is repository.bind)
|
||||
(userName === owner.bind) && (repositoryName === repository.bind)
|
||||
|
||||
def byRepository(userName: Column[String], repositoryName: Column[String]) =
|
||||
(this.userName is userName) && (this.repositoryName is repositoryName)
|
||||
(this.userName === userName) && (this.repositoryName === repositoryName)
|
||||
}
|
||||
|
||||
trait IssueTemplate extends BasicTemplate { self: Table[_] =>
|
||||
val issueId = column[Int]("ISSUE_ID")
|
||||
|
||||
def byIssue(owner: String, repository: String, issueId: Int) =
|
||||
byRepository(owner, repository) && (this.issueId is issueId.bind)
|
||||
byRepository(owner, repository) && (this.issueId === issueId.bind)
|
||||
|
||||
def byIssue(userName: Column[String], repositoryName: Column[String], issueId: Column[Int]) =
|
||||
byRepository(userName, repositoryName) && (this.issueId is issueId)
|
||||
byRepository(userName, repositoryName) && (this.issueId === issueId)
|
||||
}
|
||||
|
||||
trait LabelTemplate extends BasicTemplate { self: Table[_] =>
|
||||
val labelId = column[Int]("LABEL_ID")
|
||||
|
||||
def byLabel(owner: String, repository: String, labelId: Int) =
|
||||
byRepository(owner, repository) && (this.labelId is labelId.bind)
|
||||
byRepository(owner, repository) && (this.labelId === labelId.bind)
|
||||
|
||||
def byLabel(userName: Column[String], repositoryName: Column[String], labelId: Column[Int]) =
|
||||
byRepository(userName, repositoryName) && (this.labelId is labelId)
|
||||
byRepository(userName, repositoryName) && (this.labelId === labelId)
|
||||
}
|
||||
|
||||
trait MilestoneTemplate extends BasicTemplate { self: Table[_] =>
|
||||
val milestoneId = column[Int]("MILESTONE_ID")
|
||||
|
||||
def byMilestone(owner: String, repository: String, milestoneId: Int) =
|
||||
byRepository(owner, repository) && (this.milestoneId is milestoneId.bind)
|
||||
byRepository(owner, repository) && (this.milestoneId === milestoneId.bind)
|
||||
|
||||
def byMilestone(userName: Column[String], repositoryName: Column[String], milestoneId: Column[Int]) =
|
||||
byRepository(userName, repositoryName) && (this.milestoneId is milestoneId)
|
||||
byRepository(userName, repositoryName) && (this.milestoneId === milestoneId)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ trait CollaboratorComponent extends TemplateComponent { self: Profile =>
|
||||
def * = (userName, repositoryName, collaboratorName) <> (Collaborator.tupled, Collaborator.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, collaborator: String) =
|
||||
byRepository(owner, repository) && (collaboratorName is collaborator.bind)
|
||||
byRepository(owner, repository) && (collaboratorName === collaborator.bind)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ trait IssueCommentComponent extends TemplateComponent { self: Profile =>
|
||||
val updatedDate = column[java.util.Date]("UPDATED_DATE")
|
||||
def * = (userName, repositoryName, issueId, commentId, action, commentedUserName, content, registeredDate, updatedDate) <> (IssueComment.tupled, IssueComment.unapply)
|
||||
|
||||
def byPrimaryKey(commentId: Int) = this.commentId is commentId.bind
|
||||
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ trait IssueLabelComponent extends TemplateComponent { self: Profile =>
|
||||
class IssueLabels(tag: Tag) extends Table[IssueLabel](tag, "ISSUE_LABEL") with IssueTemplate with LabelTemplate {
|
||||
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 is labelId.bind)
|
||||
byIssue(owner, repository, issueId) && (this.labelId === labelId.bind)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ trait SshKeyComponent { self: Profile =>
|
||||
val publicKey = column[String]("PUBLIC_KEY")
|
||||
def * = (userName, sshKeyId, title, publicKey) <> (SshKey.tupled, SshKey.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String, sshKeyId: Int) = (this.userName is userName.bind) && (this.sshKeyId is sshKeyId.bind)
|
||||
def byPrimaryKey(userName: String, sshKeyId: Int) = (this.userName === userName.bind) && (this.sshKeyId === sshKeyId.bind)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ trait WebHookComponent extends TemplateComponent { self: Profile =>
|
||||
val url = column[String]("URL")
|
||||
def * = (userName, repositoryName, url) <> (WebHook.tupled, WebHook.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, url: String) = byRepository(owner, repository) && (this.url is url.bind)
|
||||
def byPrimaryKey(owner: String, repository: String, url: String) = byRepository(owner, repository) && (this.url === url.bind)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,16 +75,16 @@ trait AccountService {
|
||||
}
|
||||
|
||||
def getAccountByUserName(userName: String, includeRemoved: Boolean = false)(implicit s: Session): Option[Account] =
|
||||
Accounts filter(t => (t.userName is userName.bind) && (t.removed is false.bind, !includeRemoved)) firstOption
|
||||
Accounts filter(t => (t.userName === userName.bind) && (t.removed === false.bind, !includeRemoved)) firstOption
|
||||
|
||||
def getAccountByMailAddress(mailAddress: String, includeRemoved: Boolean = false)(implicit s: Session): Option[Account] =
|
||||
Accounts filter(t => (t.mailAddress.toLowerCase is mailAddress.toLowerCase.bind) && (t.removed is false.bind, !includeRemoved)) firstOption
|
||||
Accounts filter(t => (t.mailAddress.toLowerCase === mailAddress.toLowerCase.bind) && (t.removed === false.bind, !includeRemoved)) firstOption
|
||||
|
||||
def getAllUsers(includeRemoved: Boolean = true)(implicit s: Session): List[Account] =
|
||||
if(includeRemoved){
|
||||
Accounts sortBy(_.userName) list
|
||||
} else {
|
||||
Accounts filter (_.removed is false.bind) sortBy(_.userName) list
|
||||
Accounts filter (_.removed === false.bind) sortBy(_.userName) list
|
||||
}
|
||||
|
||||
def createAccount(userName: String, password: String, fullName: String, mailAddress: String, isAdmin: Boolean, url: Option[String])
|
||||
@@ -105,7 +105,7 @@ trait AccountService {
|
||||
|
||||
def updateAccount(account: Account)(implicit s: Session): Unit =
|
||||
Accounts
|
||||
.filter { a => a.userName is account.userName.bind }
|
||||
.filter { a => a.userName === account.userName.bind }
|
||||
.map { a => (a.password, a.fullName, a.mailAddress, a.isAdmin, a.url.?, a.registeredDate, a.updatedDate, a.lastLoginDate.?, a.removed) }
|
||||
.update (
|
||||
account.password,
|
||||
@@ -119,10 +119,10 @@ trait AccountService {
|
||||
account.isRemoved)
|
||||
|
||||
def updateAvatarImage(userName: String, image: Option[String])(implicit s: Session): Unit =
|
||||
Accounts.filter(_.userName is userName.bind).map(_.image.?).update(image)
|
||||
Accounts.filter(_.userName === userName.bind).map(_.image.?).update(image)
|
||||
|
||||
def updateLastLoginDate(userName: String)(implicit s: Session): Unit =
|
||||
Accounts.filter(_.userName is userName.bind).map(_.lastLoginDate).update(currentDate)
|
||||
Accounts.filter(_.userName === userName.bind).map(_.lastLoginDate).update(currentDate)
|
||||
|
||||
def createGroup(groupName: String, url: Option[String])(implicit s: Session): Unit =
|
||||
Accounts insert Account(
|
||||
@@ -140,10 +140,10 @@ trait AccountService {
|
||||
isRemoved = false)
|
||||
|
||||
def updateGroup(groupName: String, url: Option[String], removed: Boolean)(implicit s: Session): Unit =
|
||||
Accounts.filter(_.userName is groupName.bind).map(t => t.url.? -> t.removed).update(url, removed)
|
||||
Accounts.filter(_.userName === groupName.bind).map(t => t.url.? -> t.removed).update(url, removed)
|
||||
|
||||
def updateGroupMembers(groupName: String, members: List[(String, Boolean)])(implicit s: Session): Unit = {
|
||||
GroupMembers.filter(_.groupName is groupName.bind).delete
|
||||
GroupMembers.filter(_.groupName === groupName.bind).delete
|
||||
members.foreach { case (userName, isManager) =>
|
||||
GroupMembers insert GroupMember (groupName, userName, isManager)
|
||||
}
|
||||
@@ -151,21 +151,21 @@ trait AccountService {
|
||||
|
||||
def getGroupMembers(groupName: String)(implicit s: Session): List[GroupMember] =
|
||||
GroupMembers
|
||||
.filter(_.groupName is groupName.bind)
|
||||
.filter(_.groupName === groupName.bind)
|
||||
.sortBy(_.userName)
|
||||
.list
|
||||
|
||||
def getGroupsByUserName(userName: String)(implicit s: Session): List[String] =
|
||||
GroupMembers
|
||||
.filter(_.userName is userName.bind)
|
||||
.filter(_.userName === userName.bind)
|
||||
.sortBy(_.groupName)
|
||||
.map(_.groupName)
|
||||
.list
|
||||
|
||||
def removeUserRelatedData(userName: String)(implicit s: Session): Unit = {
|
||||
GroupMembers.filter(_.userName is userName.bind).delete
|
||||
Collaborators.filter(_.collaboratorName is userName.bind).delete
|
||||
Repositories.filter(_.userName is userName.bind).delete
|
||||
GroupMembers.filter(_.userName === userName.bind).delete
|
||||
Collaborators.filter(_.collaboratorName === userName.bind).delete
|
||||
Repositories.filter(_.userName === userName.bind).delete
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ trait ActivityService {
|
||||
.innerJoin(Repositories).on((t1, t2) => t1.byRepository(t2.userName, t2.repositoryName))
|
||||
.filter { case (t1, t2) =>
|
||||
if(isPublic){
|
||||
(t1.activityUserName is activityUserName.bind) && (t2.isPrivate is false.bind)
|
||||
(t1.activityUserName === activityUserName.bind) && (t2.isPrivate === false.bind)
|
||||
} else {
|
||||
(t1.activityUserName is activityUserName.bind)
|
||||
(t1.activityUserName === activityUserName.bind)
|
||||
}
|
||||
}
|
||||
.sortBy { case (t1, t2) => t1.activityId desc }
|
||||
@@ -24,7 +24,7 @@ trait ActivityService {
|
||||
def getRecentActivities()(implicit s: Session): List[Activity] =
|
||||
Activities
|
||||
.innerJoin(Repositories).on((t1, t2) => t1.byRepository(t2.userName, t2.repositoryName))
|
||||
.filter { case (t1, t2) => t2.isPrivate is false.bind }
|
||||
.filter { case (t1, t2) => t2.isPrivate === false.bind }
|
||||
.sortBy { case (t1, t2) => t1.activityId desc }
|
||||
.map { case (t1, t2) => t1 }
|
||||
.take(30)
|
||||
@@ -33,7 +33,7 @@ trait ActivityService {
|
||||
def getRecentActivitiesByOwners(owners : Set[String])(implicit s: Session): List[Activity] =
|
||||
Activities
|
||||
.innerJoin(Repositories).on((t1, t2) => t1.byRepository(t2.userName, t2.repositoryName))
|
||||
.filter { case (t1, t2) => (t2.isPrivate is false.bind) || (t2.userName inSetBind owners) }
|
||||
.filter { case (t1, t2) => (t2.isPrivate === false.bind) || (t2.userName inSetBind owners) }
|
||||
.sortBy { case (t1, t2) => t1.activityId desc }
|
||||
.map { case (t1, t2) => t1 }
|
||||
.take(30)
|
||||
|
||||
@@ -166,13 +166,13 @@ trait IssuesService {
|
||||
.getOrElse (repos)
|
||||
.map { case (owner, repository) => t1.byRepository(owner, repository) }
|
||||
.foldLeft[Column[Boolean]](false) ( _ || _ ) &&
|
||||
(t1.closed is (condition.state == "closed").bind) &&
|
||||
(t1.milestoneId is condition.milestoneId.get.get.bind, condition.milestoneId.flatten.isDefined) &&
|
||||
(t1.milestoneId isNull, condition.milestoneId == Some(None)) &&
|
||||
(t1.assignedUserName is filterUser("assigned").bind, filterUser.get("assigned").isDefined) &&
|
||||
(t1.openedUserName is filterUser("created_by").bind, filterUser.get("created_by").isDefined) &&
|
||||
(t1.openedUserName isNot filterUser("not_created_by").bind, filterUser.get("not_created_by").isDefined) &&
|
||||
(t1.pullRequest is true.bind, onlyPullRequest) &&
|
||||
(t1.closed === (condition.state == "closed").bind) &&
|
||||
(t1.milestoneId === condition.milestoneId.get.get.bind, condition.milestoneId.flatten.isDefined) &&
|
||||
(t1.milestoneId.? isEmpty, condition.milestoneId == Some(None)) &&
|
||||
(t1.assignedUserName === filterUser("assigned").bind, filterUser.get("assigned").isDefined) &&
|
||||
(t1.openedUserName === filterUser("created_by").bind, filterUser.get("created_by").isDefined) &&
|
||||
(t1.openedUserName =!= filterUser("not_created_by").bind, filterUser.get("not_created_by").isDefined) &&
|
||||
(t1.pullRequest === true.bind, onlyPullRequest) &&
|
||||
(IssueLabels filter { t2 =>
|
||||
(t2.byIssue(t1.userName, t1.repositoryName, t1.issueId)) &&
|
||||
(t2.labelId in
|
||||
|
||||
@@ -41,7 +41,7 @@ trait MilestonesService {
|
||||
|
||||
def getMilestonesWithIssueCount(owner: String, repository: String)(implicit s: Session): List[(Milestone, Int, Int)] = {
|
||||
val counts = Issues
|
||||
.filter { t => (t.byRepository(owner, repository)) && (t.milestoneId isNotNull) }
|
||||
.filter { t => (t.byRepository(owner, repository)) && (t.milestoneId.? isDefined) }
|
||||
.groupBy { t => t.milestoneId -> t.closed }
|
||||
.map { case (t1, t2) => t1._1 -> t1._2 -> t2.length }
|
||||
.toMap
|
||||
|
||||
@@ -26,9 +26,9 @@ trait PullRequestService { self: IssuesService =>
|
||||
PullRequests
|
||||
.innerJoin(Issues).on { (t1, t2) => t1.byPrimaryKey(t2.userName, t2.repositoryName, t2.issueId) }
|
||||
.filter { case (t1, t2) =>
|
||||
(t2.closed is closed.bind) &&
|
||||
(t1.userName is owner.get.bind, owner.isDefined) &&
|
||||
(t1.repositoryName is 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 }
|
||||
@@ -55,10 +55,10 @@ trait PullRequestService { self: IssuesService =>
|
||||
PullRequests
|
||||
.innerJoin(Issues).on { (t1, t2) => t1.byPrimaryKey(t2.userName, t2.repositoryName, t2.issueId) }
|
||||
.filter { case (t1, t2) =>
|
||||
(t1.requestUserName is userName.bind) &&
|
||||
(t1.requestRepositoryName is repositoryName.bind) &&
|
||||
(t1.requestBranch is branch.bind) &&
|
||||
(t2.closed is closed.bind)
|
||||
(t1.requestUserName === userName.bind) &&
|
||||
(t1.requestRepositoryName === repositoryName.bind) &&
|
||||
(t1.requestBranch === branch.bind) &&
|
||||
(t2.closed === closed.bind)
|
||||
}
|
||||
.map { case (t1, t2) => t1 }
|
||||
.list
|
||||
|
||||
@@ -58,15 +58,15 @@ trait RepositoryService { self: AccountService =>
|
||||
val collaborators = Collaborators.filter(_.byRepository(oldUserName, oldRepositoryName)).list
|
||||
|
||||
Repositories.filter { t =>
|
||||
(t.originUserName is oldUserName.bind) && (t.originRepositoryName is oldRepositoryName.bind)
|
||||
(t.originUserName === oldUserName.bind) && (t.originRepositoryName === oldRepositoryName.bind)
|
||||
}.map { t => t.originUserName -> t.originRepositoryName }.update(newUserName, newRepositoryName)
|
||||
|
||||
Repositories.filter { t =>
|
||||
(t.parentUserName is oldUserName.bind) && (t.parentRepositoryName is oldRepositoryName.bind)
|
||||
(t.parentUserName === oldUserName.bind) && (t.parentRepositoryName === oldRepositoryName.bind)
|
||||
}.map { t => t.originUserName -> t.originRepositoryName }.update(newUserName, newRepositoryName)
|
||||
|
||||
PullRequests.filter { t =>
|
||||
t.requestRepositoryName is oldRepositoryName.bind
|
||||
t.requestRepositoryName === oldRepositoryName.bind
|
||||
}.map { t => t.requestUserName -> t.requestRepositoryName }.update(newUserName, newRepositoryName)
|
||||
|
||||
deleteRepository(oldUserName, oldRepositoryName)
|
||||
@@ -102,7 +102,7 @@ trait RepositoryService { self: AccountService =>
|
||||
}.map { t => t.activityId -> t.message }.list
|
||||
|
||||
updateActivities.foreach { case (activityId, message) =>
|
||||
Activities.filter(_.activityId is activityId.bind).map(_.message).update(
|
||||
Activities.filter(_.activityId === activityId.bind).map(_.message).update(
|
||||
message
|
||||
.replace(s"[repo:${oldUserName}/${oldRepositoryName}]" ,s"[repo:${newUserName}/${newRepositoryName}]")
|
||||
.replace(s"[branch:${oldUserName}/${oldRepositoryName}#" ,s"[branch:${newUserName}/${newRepositoryName}#")
|
||||
@@ -136,7 +136,7 @@ trait RepositoryService { self: AccountService =>
|
||||
* @return the list of repository names
|
||||
*/
|
||||
def getRepositoryNamesOfUser(userName: String)(implicit s: Session): List[String] =
|
||||
Repositories filter(_.userName is userName.bind) map (_.repositoryName) list
|
||||
Repositories filter(_.userName === userName.bind) map (_.repositoryName) list
|
||||
|
||||
/**
|
||||
* Returns the specified repository information.
|
||||
@@ -150,7 +150,7 @@ trait RepositoryService { self: AccountService =>
|
||||
(Repositories filter { t => t.byRepository(userName, repositoryName) } firstOption) map { repository =>
|
||||
// for getting issue count and pull request count
|
||||
val issues = Issues.filter { t =>
|
||||
t.byRepository(repository.userName, repository.repositoryName) && (t.closed is false.bind)
|
||||
t.byRepository(repository.userName, repository.repositoryName) && (t.closed === false.bind)
|
||||
}.map(_.pullRequest).list
|
||||
|
||||
new RepositoryInfo(
|
||||
@@ -175,8 +175,8 @@ trait RepositoryService { self: AccountService =>
|
||||
def getUserRepositories(userName: String, baseUrl: String, withoutPhysicalInfo: Boolean = false)
|
||||
(implicit s: Session): List[RepositoryInfo] = {
|
||||
Repositories.filter { t1 =>
|
||||
(t1.userName is userName.bind) ||
|
||||
(Collaborators.filter { t2 => t2.byRepository(t1.userName, t1.repositoryName) && (t2.collaboratorName is userName.bind)} exists)
|
||||
(t1.userName === userName.bind) ||
|
||||
(Collaborators.filter { t2 => t2.byRepository(t1.userName, t1.repositoryName) && (t2.collaboratorName === userName.bind)} exists)
|
||||
}.sortBy(_.lastActivityDate desc).list.map{ repository =>
|
||||
new RepositoryInfo(
|
||||
if(withoutPhysicalInfo){
|
||||
@@ -212,13 +212,13 @@ trait RepositoryService { self: AccountService =>
|
||||
case Some(x) if(x.isAdmin) => Repositories
|
||||
// for Normal Users
|
||||
case Some(x) if(!x.isAdmin) =>
|
||||
Repositories filter { t => (t.isPrivate is false.bind) || (t.userName is x.userName) ||
|
||||
(Collaborators.filter { t2 => t2.byRepository(t.userName, t.repositoryName) && (t2.collaboratorName is x.userName.bind)} exists)
|
||||
Repositories filter { t => (t.isPrivate === false.bind) || (t.userName === x.userName) ||
|
||||
(Collaborators.filter { t2 => t2.byRepository(t.userName, t.repositoryName) && (t2.collaboratorName === x.userName.bind)} exists)
|
||||
}
|
||||
// for Guests
|
||||
case None => Repositories filter(_.isPrivate is false.bind)
|
||||
case None => Repositories filter(_.isPrivate === false.bind)
|
||||
}).filter { t =>
|
||||
repositoryUserName.map { userName => t.userName is userName.bind } getOrElse LiteralColumn(true)
|
||||
repositoryUserName.map { userName => t.userName === userName.bind } getOrElse LiteralColumn(true)
|
||||
}.sortBy(_.lastActivityDate desc).list.map{ repository =>
|
||||
new RepositoryInfo(
|
||||
if(withoutPhysicalInfo){
|
||||
@@ -307,13 +307,13 @@ trait RepositoryService { self: AccountService =>
|
||||
|
||||
private def getForkedCount(userName: String, repositoryName: String)(implicit s: Session): Int =
|
||||
Query(Repositories.filter { t =>
|
||||
(t.originUserName is userName.bind) && (t.originRepositoryName is repositoryName.bind)
|
||||
(t.originUserName === userName.bind) && (t.originRepositoryName === repositoryName.bind)
|
||||
}.length).first
|
||||
|
||||
|
||||
def getForkedRepositories(userName: String, repositoryName: String)(implicit s: Session): List[(String, String)] =
|
||||
Repositories.filter { t =>
|
||||
(t.originUserName is userName.bind) && (t.originRepositoryName is repositoryName.bind)
|
||||
(t.originUserName === userName.bind) && (t.originRepositoryName === repositoryName.bind)
|
||||
}
|
||||
.sortBy(_.userName asc).map(t => t.userName -> t.repositoryName).list
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ trait SshKeyService {
|
||||
SshKeys insert SshKey(userName = userName, title = title, publicKey = publicKey)
|
||||
|
||||
def getPublicKeys(userName: String)(implicit s: Session): List[SshKey] =
|
||||
SshKeys.filter(_.userName is userName.bind).sortBy(_.sshKeyId).list
|
||||
SshKeys.filter(_.userName === userName.bind).sortBy(_.sshKeyId).list
|
||||
|
||||
def deletePublicKey(userName: String, sshKeyId: Int)(implicit s: Session): Unit =
|
||||
SshKeys filter (_.byPrimaryKey(userName, sshKeyId)) delete
|
||||
|
||||
@@ -44,7 +44,7 @@ trait WebHookService {
|
||||
val httpClient = HttpClientBuilder.create.build
|
||||
|
||||
webHookURLs.foreach { webHookUrl =>
|
||||
val f = future {
|
||||
val f = Future {
|
||||
logger.debug(s"start web hook invocation for ${webHookUrl}")
|
||||
val httpPost = new HttpPost(webHookUrl.url)
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class Mailer(private val smtp: Smtp) extends Notifier {
|
||||
(msg: String => String)(implicit context: Context) = {
|
||||
val database = Database(context.request.getServletContext)
|
||||
|
||||
val f = future {
|
||||
val f = Future {
|
||||
database withSession { implicit session =>
|
||||
getIssue(r.owner, r.name, issueId.toString) foreach { issue =>
|
||||
defining(
|
||||
|
||||
Reference in New Issue
Block a user