diff --git a/src/main/scala/gitbucket/core/service/AccountService.scala b/src/main/scala/gitbucket/core/service/AccountService.scala index d6344cb..cfeeefc 100644 --- a/src/main/scala/gitbucket/core/service/AccountService.scala +++ b/src/main/scala/gitbucket/core/service/AccountService.scala @@ -1,14 +1,13 @@ package gitbucket.core.service +import org.slf4j.LoggerFactory import gitbucket.core.model.{GroupMember, Account} import gitbucket.core.model.Profile._ import gitbucket.core.util.{StringUtil, LDAPUtil} +import StringUtil._ import gitbucket.core.service.SystemSettingsService.SystemSettings import profile._ import profile.api._ -import StringUtil._ -import org.slf4j.LoggerFactory -// TODO Why is direct import required? import gitbucket.core.model.Profile.dateColumnType trait AccountService { diff --git a/src/main/scala/gitbucket/core/service/CommitStatusService.scala b/src/main/scala/gitbucket/core/service/CommitStatusService.scala index 45b5bb7..a290d86 100644 --- a/src/main/scala/gitbucket/core/service/CommitStatusService.scala +++ b/src/main/scala/gitbucket/core/service/CommitStatusService.scala @@ -3,13 +3,8 @@ import gitbucket.core.model.Profile._ import profile._ import profile.api._ - -import gitbucket.core.model.{CommitState, CommitStatus, Account} -import gitbucket.core.util.Implicits._ -import gitbucket.core.util.StringUtil._ -import gitbucket.core.service.RepositoryService.RepositoryInfo -import org.joda.time.LocalDateTime import gitbucket.core.model.Profile.dateColumnType +import gitbucket.core.model.{CommitState, CommitStatus, Account} trait CommitStatusService { /** insert or update */ diff --git a/src/main/scala/gitbucket/core/service/CommitsService.scala b/src/main/scala/gitbucket/core/service/CommitsService.scala index f2f37b3..38584ad 100644 --- a/src/main/scala/gitbucket/core/service/CommitsService.scala +++ b/src/main/scala/gitbucket/core/service/CommitsService.scala @@ -4,7 +4,7 @@ import gitbucket.core.model.Profile._ import profile._ import profile.api._ - +import gitbucket.core.model.Profile.dateColumnType trait CommitsService { @@ -38,7 +38,6 @@ issueId = issueId) def updateCommitComment(commentId: Int, content: String)(implicit s: Session) = { - import gitbucket.core.model.Profile.dateColumnType CommitComments .filter (_.byPrimaryKey(commentId)) .map { t => (t.content, t.updatedDate) } diff --git a/src/main/scala/gitbucket/core/service/IssuesService.scala b/src/main/scala/gitbucket/core/service/IssuesService.scala index ddad69c..a69b3cb 100644 --- a/src/main/scala/gitbucket/core/service/IssuesService.scala +++ b/src/main/scala/gitbucket/core/service/IssuesService.scala @@ -1,14 +1,13 @@ package gitbucket.core.service -import gitbucket.core.model.Profile._ import gitbucket.core.util.JGitUtil.CommitInfo -import profile._ -import profile.api._ import gitbucket.core.util.StringUtil._ import gitbucket.core.util.Implicits._ import gitbucket.core.model.{Account, CommitState, Issue, IssueComment, IssueLabel, Label, PullRequest, Repository} - -//import scala.slick.jdbc.{StaticQuery => Q} +import gitbucket.core.model.Profile._ +import profile._ +import profile.api._ +import gitbucket.core.model.Profile.dateColumnType trait IssuesService { @@ -277,7 +276,6 @@ } def updateIssue(owner: String, repository: String, issueId: Int, title: String, content: Option[String])(implicit s: Session) = { - import gitbucket.core.model.Profile.dateColumnType Issues .filter (_.byPrimaryKey(owner, repository, issueId)) .map { t => (t.title, t.content.?, t.updatedDate) } @@ -293,7 +291,6 @@ Issues.filter (_.byPrimaryKey(owner, repository, issueId)).map(_.milestoneId?).unsafeUpdate (milestoneId) def updateComment(commentId: Int, content: String)(implicit s: Session) = { - import gitbucket.core.model.Profile.dateColumnType IssueComments.filter (_.byPrimaryKey(commentId)).map(t => (t.content, t.updatedDate)).unsafeUpdate(content, currentDate) } @@ -301,7 +298,6 @@ IssueComments filter (_.byPrimaryKey(commentId)) unsafeDelete def updateClosed(owner: String, repository: String, issueId: Int, closed: Boolean)(implicit s: Session) = { - import gitbucket.core.model.Profile.dateColumnType (Issues filter (_.byPrimaryKey(owner, repository, issueId)) map(t => (t.closed, t.updatedDate))).unsafeUpdate((closed, currentDate)) } diff --git a/src/main/scala/gitbucket/core/service/MilestonesService.scala b/src/main/scala/gitbucket/core/service/MilestonesService.scala index 9187bae..bb6b880 100644 --- a/src/main/scala/gitbucket/core/service/MilestonesService.scala +++ b/src/main/scala/gitbucket/core/service/MilestonesService.scala @@ -4,7 +4,6 @@ import gitbucket.core.model.Profile._ import profile._ import profile.api._ -// TODO Why is direct import required? import gitbucket.core.model.Profile.dateColumnType trait MilestonesService { diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 38f4c7b..486faa7 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -1,11 +1,12 @@ package gitbucket.core.service import gitbucket.core.controller.Context +import gitbucket.core.util.JGitUtil import gitbucket.core.model.{Collaborator, Repository, Account} import gitbucket.core.model.Profile._ -import gitbucket.core.util.JGitUtil import profile._ import profile.api._ +import gitbucket.core.model.Profile.dateColumnType trait RepositoryService { self: AccountService => import RepositoryService._ @@ -237,8 +238,6 @@ * @return the repository information list */ def getAllRepositories(userName: String)(implicit s: Session): List[(String, String)] = { - import gitbucket.core.model.Profile.dateColumnType - Repositories.filter { t1 => (t1.isPrivate === false.bind) || (t1.userName === userName.bind) || @@ -249,8 +248,6 @@ } def getUserRepositories(userName: String, withoutPhysicalInfo: Boolean = false)(implicit s: Session): List[RepositoryInfo] = { - import gitbucket.core.model.Profile.dateColumnType - Repositories.filter { t1 => (t1.userName === userName.bind) || (Collaborators.filter { t2 => t2.byRepository(t1.userName, t1.repositoryName) && (t2.collaboratorName === userName.bind)} exists) @@ -283,8 +280,6 @@ def getVisibleRepositories(loginAccount: Option[Account], repositoryUserName: Option[String] = None, withoutPhysicalInfo: Boolean = false) (implicit s: Session): List[RepositoryInfo] = { - import gitbucket.core.model.Profile.dateColumnType - (loginAccount match { // for Administrators case Some(x) if(x.isAdmin) => Repositories @@ -324,7 +319,6 @@ * Updates the last activity date of the repository. */ def updateLastActivityDate(userName: String, repositoryName: String)(implicit s: Session): Unit = { - import gitbucket.core.model.Profile.dateColumnType Repositories.filter(_.byRepository(userName, repositoryName)).map(_.lastActivityDate).unsafeUpdate(currentDate) } @@ -335,8 +329,6 @@ description: Option[String], isPrivate: Boolean, enableIssues: Boolean, externalIssuesUrl: Option[String], enableWiki: Boolean, allowWikiEditing: Boolean, externalWikiUrl: Option[String])(implicit s: Session): Unit = { - import gitbucket.core.model.Profile.dateColumnType - Repositories.filter(_.byRepository(userName, repositoryName)) .map { r => (r.description.?, r.isPrivate, r.enableIssues, r.externalIssuesUrl.?, r.enableWiki, r.allowWikiEditing, r.externalWikiUrl.?, r.updatedDate) } .unsafeUpdate (description, isPrivate, enableIssues, externalIssuesUrl, enableWiki, allowWikiEditing, externalWikiUrl, currentDate)