prepare Scala 3

This commit is contained in:
xuwei-k
2024-06-17 14:54:33 +09:00
committed by kenji yoshida
parent 67dd604469
commit c2068f58e7
42 changed files with 78 additions and 221 deletions

View File

@@ -38,21 +38,9 @@ class AccountController
with RequestCache with RequestCache
trait AccountControllerBase extends AccountManagementControllerBase { trait AccountControllerBase extends AccountManagementControllerBase {
self: AccountService self: AccountService & RepositoryService & ActivityService & WikiService & LabelsService & SshKeyService &
with RepositoryService GpgKeyService & OneselfAuthenticator & UsersAuthenticator & GroupManagerAuthenticator & ReadableUsersAuthenticator &
with ActivityService AccessTokenService & WebHookService & PrioritiesService & RepositoryCreationService =>
with WikiService
with LabelsService
with SshKeyService
with GpgKeyService
with OneselfAuthenticator
with UsersAuthenticator
with GroupManagerAuthenticator
with ReadableUsersAuthenticator
with AccessTokenService
with WebHookService
with PrioritiesService
with RepositoryCreationService =>
case class AccountNewForm( case class AccountNewForm(
userName: String, userName: String,

View File

@@ -28,12 +28,8 @@ class DashboardController
with RequestCache with RequestCache
trait DashboardControllerBase extends ControllerBase { trait DashboardControllerBase extends ControllerBase {
self: IssuesService self: IssuesService & PullRequestService & RepositoryService & AccountService & CommitStatusService &
with PullRequestService UsersAuthenticator =>
with RepositoryService
with AccountService
with CommitStatusService
with UsersAuthenticator =>
get("/dashboard/repos")(usersOnly { get("/dashboard/repos")(usersOnly {
context.withLoginAccount { loginAccount => context.withLoginAccount { loginAccount =>

View File

@@ -34,15 +34,8 @@ class IndexController
with RequestCache with RequestCache
trait IndexControllerBase extends ControllerBase { trait IndexControllerBase extends ControllerBase {
self: RepositoryService self: RepositoryService & ActivityService & AccountService & RepositorySearchService & UsersAuthenticator &
with ActivityService ReferrerAuthenticator & AccessTokenService & AccountFederationService & OpenIDConnectService =>
with AccountService
with RepositorySearchService
with UsersAuthenticator
with ReferrerAuthenticator
with AccessTokenService
with AccountFederationService
with OpenIDConnectService =>
case class SignInForm(userName: String, password: String, hash: Option[String]) case class SignInForm(userName: String, password: String, hash: Option[String])

View File

@@ -34,21 +34,10 @@ class IssuesController
with RequestCache with RequestCache
trait IssuesControllerBase extends ControllerBase { trait IssuesControllerBase extends ControllerBase {
self: IssuesService self: IssuesService & RepositoryService & AccountService & LabelsService & MilestonesService & ActivityService &
with RepositoryService HandleCommentService & IssueCreationService & CustomFieldsService & ReadableUsersAuthenticator &
with AccountService ReferrerAuthenticator & WritableUsersAuthenticator & PullRequestService & WebHookIssueCommentService &
with LabelsService PrioritiesService =>
with MilestonesService
with ActivityService
with HandleCommentService
with IssueCreationService
with CustomFieldsService
with ReadableUsersAuthenticator
with ReferrerAuthenticator
with WritableUsersAuthenticator
with PullRequestService
with WebHookIssueCommentService
with PrioritiesService =>
case class IssueCreateForm( case class IssueCreateForm(
title: String, title: String,

View File

@@ -28,11 +28,7 @@ class LabelsController
with WritableUsersAuthenticator with WritableUsersAuthenticator
trait LabelsControllerBase extends ControllerBase { trait LabelsControllerBase extends ControllerBase {
self: LabelsService self: LabelsService & IssuesService & RepositoryService & ReferrerAuthenticator & WritableUsersAuthenticator =>
with IssuesService
with RepositoryService
with ReferrerAuthenticator
with WritableUsersAuthenticator =>
case class LabelForm(labelName: String, color: String) case class LabelForm(labelName: String, color: String)

View File

@@ -26,11 +26,8 @@ class MilestonesController
with WritableUsersAuthenticator with WritableUsersAuthenticator
trait MilestonesControllerBase extends ControllerBase { trait MilestonesControllerBase extends ControllerBase {
self: MilestonesService self: MilestonesService & RepositoryService & CommitStatusService & ReferrerAuthenticator &
with RepositoryService WritableUsersAuthenticator =>
with CommitStatusService
with ReferrerAuthenticator
with WritableUsersAuthenticator =>
case class MilestoneForm(title: String, description: Option[String], dueDate: Option[java.util.Date]) case class MilestoneForm(title: String, description: Option[String], dueDate: Option[java.util.Date])

View File

@@ -28,11 +28,7 @@ class PrioritiesController
with WritableUsersAuthenticator with WritableUsersAuthenticator
trait PrioritiesControllerBase extends ControllerBase { trait PrioritiesControllerBase extends ControllerBase {
self: PrioritiesService self: PrioritiesService & IssuesService & RepositoryService & ReferrerAuthenticator & WritableUsersAuthenticator =>
with IssuesService
with RepositoryService
with ReferrerAuthenticator
with WritableUsersAuthenticator =>
case class PriorityForm(priorityName: String, description: Option[String], color: String) case class PriorityForm(priorityName: String, description: Option[String], color: String)

View File

@@ -40,23 +40,10 @@ class PullRequestsController
with RequestCache with RequestCache
trait PullRequestsControllerBase extends ControllerBase { trait PullRequestsControllerBase extends ControllerBase {
self: RepositoryService self: RepositoryService & AccountService & IssuesService & MilestonesService & LabelsService & CustomFieldsService &
with AccountService CommitsService & ActivityService & PullRequestService & WebHookPullRequestService & ReadableUsersAuthenticator &
with IssuesService ReferrerAuthenticator & WritableUsersAuthenticator & CommitStatusService & MergeService & ProtectedBranchService &
with MilestonesService PrioritiesService =>
with LabelsService
with CustomFieldsService
with CommitsService
with ActivityService
with PullRequestService
with WebHookPullRequestService
with ReadableUsersAuthenticator
with ReferrerAuthenticator
with WritableUsersAuthenticator
with CommitStatusService
with MergeService
with ProtectedBranchService
with PrioritiesService =>
val pullRequestForm = mapping( val pullRequestForm = mapping(
"title" -> trim(label("Title", text(required))), "title" -> trim(label("Title", text(required))),
@@ -569,7 +556,7 @@ trait PullRequestsControllerBase extends ControllerBase {
val (originOwner, tmpOriginBranch) = parseCompareIdentifier(origin, forkedRepository.owner) val (originOwner, tmpOriginBranch) = parseCompareIdentifier(origin, forkedRepository.owner)
val (forkedOwner, tmpForkedBranch) = parseCompareIdentifier(forked, forkedRepository.owner) val (forkedOwner, tmpForkedBranch) = parseCompareIdentifier(forked, forkedRepository.owner)
(for ( (for {
originRepositoryName <- originRepositoryName <-
if (originOwner == forkedOwner) { if (originOwner == forkedOwner) {
Some(forkedRepository.name) Some(forkedRepository.name)
@@ -579,9 +566,9 @@ trait PullRequestsControllerBase extends ControllerBase {
.find(_.userName == originOwner) .find(_.userName == originOwner)
.map(_.repositoryName) .map(_.repositoryName)
} }
}; }
originRepository <- getRepository(originOwner, originRepositoryName) originRepository <- getRepository(originOwner, originRepositoryName)
) yield { } yield {
Using.resources( Using.resources(
Git.open(getRepositoryDir(originRepository.owner, originRepository.name)), Git.open(getRepositoryDir(originRepository.owner, originRepository.name)),
Git.open(getRepositoryDir(forkedRepository.owner, forkedRepository.name)) Git.open(getRepositoryDir(forkedRepository.owner, forkedRepository.name))

View File

@@ -33,13 +33,8 @@ class ReleaseController
with RequestCache with RequestCache
trait ReleaseControllerBase extends ControllerBase { trait ReleaseControllerBase extends ControllerBase {
self: RepositoryService self: RepositoryService & AccountService & ReleaseService & ReadableUsersAuthenticator & ReferrerAuthenticator &
with AccountService WritableUsersAuthenticator & ActivityService =>
with ReleaseService
with ReadableUsersAuthenticator
with ReferrerAuthenticator
with WritableUsersAuthenticator
with ActivityService =>
case class ReleaseForm( case class ReleaseForm(
name: String, name: String,

View File

@@ -37,16 +37,8 @@ class RepositorySettingsController
with RequestCache with RequestCache
trait RepositorySettingsControllerBase extends ControllerBase { trait RepositorySettingsControllerBase extends ControllerBase {
self: RepositoryService self: RepositoryService & AccountService & WebHookService & ProtectedBranchService & CommitStatusService &
with AccountService DeployKeyService & CustomFieldsService & ActivityService & OwnerAuthenticator & UsersAuthenticator =>
with WebHookService
with ProtectedBranchService
with CommitStatusService
with DeployKeyService
with CustomFieldsService
with ActivityService
with OwnerAuthenticator
with UsersAuthenticator =>
// for repository options // for repository options
case class OptionsForm( case class OptionsForm(

View File

@@ -65,21 +65,10 @@ class RepositoryViewerController
* The repository viewer. * The repository viewer.
*/ */
trait RepositoryViewerControllerBase extends ControllerBase { trait RepositoryViewerControllerBase extends ControllerBase {
self: RepositoryService self: RepositoryService & RepositoryCommitFileService & AccountService & ActivityService & IssuesService &
with RepositoryCommitFileService WebHookService & CommitsService & ReadableUsersAuthenticator & ReferrerAuthenticator & WritableUsersAuthenticator &
with AccountService PullRequestService & CommitStatusService & WebHookPullRequestService & WebHookPullRequestReviewCommentService &
with ActivityService ProtectedBranchService =>
with IssuesService
with WebHookService
with CommitsService
with ReadableUsersAuthenticator
with ReferrerAuthenticator
with WritableUsersAuthenticator
with PullRequestService
with CommitStatusService
with WebHookPullRequestService
with WebHookPullRequestReviewCommentService
with ProtectedBranchService =>
ArchiveCommand.registerFormat("zip", new ZipFormat) ArchiveCommand.registerFormat("zip", new ZipFormat)
ArchiveCommand.registerFormat("tar.gz", new TgzFormat) ArchiveCommand.registerFormat("tar.gz", new TgzFormat)

View File

@@ -29,7 +29,7 @@ case class Table(name: String, columns: Seq[Column])
case class Column(name: String, primaryKey: Boolean) case class Column(name: String, primaryKey: Boolean)
trait SystemSettingsControllerBase extends AccountManagementControllerBase { trait SystemSettingsControllerBase extends AccountManagementControllerBase {
self: AccountService with RepositoryService with AdminAuthenticator => self: AccountService & RepositoryService & AdminAuthenticator =>
private val form = mapping( private val form = mapping(
"baseUrl" -> trim(label("Base URL", optional(text()))), "baseUrl" -> trim(label("Base URL", optional(text()))),

View File

@@ -10,7 +10,7 @@ import org.scalatra.servlet.ServletBase
/** /**
* Extends scalatra-forms to support the client-side validation and Ajax requests as well. * Extends scalatra-forms to support the client-side validation and Ajax requests as well.
*/ */
trait ValidationSupport extends FormSupport { self: ServletBase with JacksonJsonSupport with I18nSupport => trait ValidationSupport extends FormSupport { self: ServletBase & JacksonJsonSupport & I18nSupport =>
def get[T](path: String, form: ValueType[T])(action: T => Any): Route = { def get[T](path: String, form: ValueType[T])(action: T => Any): Route = {
registerValidate(path, form) registerValidate(path, form)

View File

@@ -29,13 +29,8 @@ class WikiController
with RequestCache with RequestCache
trait WikiControllerBase extends ControllerBase { trait WikiControllerBase extends ControllerBase {
self: WikiService self: WikiService & RepositoryService & AccountService & ActivityService & WebHookService &
with RepositoryService ReadableUsersAuthenticator & ReferrerAuthenticator =>
with AccountService
with ActivityService
with WebHookService
with ReadableUsersAuthenticator
with ReferrerAuthenticator =>
case class WikiPageEditForm( case class WikiPageEditForm(
pageName: String, pageName: String,

View File

@@ -15,7 +15,7 @@ import scala.jdk.CollectionConverters._
import scala.util.Using import scala.util.Using
trait ApiGitReferenceControllerBase extends ControllerBase { trait ApiGitReferenceControllerBase extends ControllerBase {
self: ReferrerAuthenticator with WritableUsersAuthenticator => self: ReferrerAuthenticator & WritableUsersAuthenticator =>
private val logger = LoggerFactory.getLogger(classOf[ApiGitReferenceControllerBase]) private val logger = LoggerFactory.getLogger(classOf[ApiGitReferenceControllerBase])

View File

@@ -7,13 +7,8 @@ import gitbucket.core.util.{ReadableUsersAuthenticator, ReferrerAuthenticator, R
import org.scalatra.ActionResult import org.scalatra.ActionResult
trait ApiIssueCommentControllerBase extends ControllerBase { trait ApiIssueCommentControllerBase extends ControllerBase {
self: AccountService self: AccountService & IssuesService & RepositoryService & HandleCommentService & MilestonesService &
with IssuesService ReadableUsersAuthenticator & ReferrerAuthenticator =>
with RepositoryService
with HandleCommentService
with MilestonesService
with ReadableUsersAuthenticator
with ReferrerAuthenticator =>
/* /*
* i. List issue comments for a repository * i. List issue comments for a repository
* https://docs.github.com/en/rest/reference/issues#list-issue-comments-for-a-repository * https://docs.github.com/en/rest/reference/issues#list-issue-comments-for-a-repository

View File

@@ -9,12 +9,8 @@ import gitbucket.core.util.{ReadableUsersAuthenticator, ReferrerAuthenticator, R
import gitbucket.core.util.Implicits._ import gitbucket.core.util.Implicits._
trait ApiIssueControllerBase extends ControllerBase { trait ApiIssueControllerBase extends ControllerBase {
self: AccountService self: AccountService & IssuesService & IssueCreationService & MilestonesService & ReadableUsersAuthenticator &
with IssuesService ReferrerAuthenticator =>
with IssueCreationService
with MilestonesService
with ReadableUsersAuthenticator
with ReferrerAuthenticator =>
/* /*
* i. List issues * i. List issues
* https://developer.github.com/v3/issues/#list-issues * https://developer.github.com/v3/issues/#list-issues

View File

@@ -7,11 +7,7 @@ import gitbucket.core.util._
import org.scalatra.{Created, NoContent, UnprocessableEntity} import org.scalatra.{Created, NoContent, UnprocessableEntity}
trait ApiIssueLabelControllerBase extends ControllerBase { trait ApiIssueLabelControllerBase extends ControllerBase {
self: AccountService self: AccountService & IssuesService & LabelsService & ReferrerAuthenticator & WritableUsersAuthenticator =>
with IssuesService
with LabelsService
with ReferrerAuthenticator
with WritableUsersAuthenticator =>
/* /*
* i. List all labels for this repository * i. List all labels for this repository

View File

@@ -7,7 +7,7 @@ import gitbucket.core.util.Implicits._
import org.scalatra.NoContent import org.scalatra.NoContent
trait ApiIssueMilestoneControllerBase extends ControllerBase { trait ApiIssueMilestoneControllerBase extends ControllerBase {
self: MilestonesService with WritableUsersAuthenticator with ReferrerAuthenticator => self: MilestonesService & WritableUsersAuthenticator & ReferrerAuthenticator =>
/* /*
* i. List milestones * i. List milestones

View File

@@ -6,7 +6,7 @@ import gitbucket.core.util.Implicits._
import gitbucket.core.util.{AdminAuthenticator, UsersAuthenticator} import gitbucket.core.util.{AdminAuthenticator, UsersAuthenticator}
trait ApiOrganizationControllerBase extends ControllerBase { trait ApiOrganizationControllerBase extends ControllerBase {
self: RepositoryService with AccountService with AdminAuthenticator with UsersAuthenticator => self: RepositoryService & AccountService & AdminAuthenticator & UsersAuthenticator =>
/* /*
* i. List your organizations * i. List your organizations

View File

@@ -16,14 +16,8 @@ import scala.util.Using
import scala.jdk.CollectionConverters._ import scala.jdk.CollectionConverters._
trait ApiPullRequestControllerBase extends ControllerBase { trait ApiPullRequestControllerBase extends ControllerBase {
self: AccountService self: AccountService & IssuesService & PullRequestService & RepositoryService & MergeService & ReferrerAuthenticator &
with IssuesService ReadableUsersAuthenticator & WritableUsersAuthenticator =>
with PullRequestService
with RepositoryService
with MergeService
with ReferrerAuthenticator
with ReadableUsersAuthenticator
with WritableUsersAuthenticator =>
/* /*
* i. Link Relations * i. Link Relations

View File

@@ -11,7 +11,7 @@ import org.apache.commons.io.FileUtils
import org.scalatra.NoContent import org.scalatra.NoContent
trait ApiReleaseControllerBase extends ControllerBase { trait ApiReleaseControllerBase extends ControllerBase {
self: AccountService with ReleaseService with ReferrerAuthenticator with WritableUsersAuthenticator => self: AccountService & ReleaseService & ReferrerAuthenticator & WritableUsersAuthenticator =>
/** /**
* i. List releases for a repository * i. List releases for a repository

View File

@@ -12,15 +12,8 @@ import org.scalatra.NoContent
import scala.util.Using import scala.util.Using
trait ApiRepositoryBranchControllerBase extends ControllerBase { trait ApiRepositoryBranchControllerBase extends ControllerBase {
self: RepositoryService self: RepositoryService & AccountService & OwnerAuthenticator & UsersAuthenticator & GroupManagerAuthenticator &
with AccountService ProtectedBranchService & ReferrerAuthenticator & ReadableUsersAuthenticator & WritableUsersAuthenticator =>
with OwnerAuthenticator
with UsersAuthenticator
with GroupManagerAuthenticator
with ProtectedBranchService
with ReferrerAuthenticator
with ReadableUsersAuthenticator
with WritableUsersAuthenticator =>
/** /**
* i. List branches * i. List branches

View File

@@ -7,7 +7,7 @@ import gitbucket.core.util.{OwnerAuthenticator, ReferrerAuthenticator}
import org.scalatra.NoContent import org.scalatra.NoContent
trait ApiRepositoryCollaboratorControllerBase extends ControllerBase { trait ApiRepositoryCollaboratorControllerBase extends ControllerBase {
self: RepositoryService with AccountService with ReferrerAuthenticator with OwnerAuthenticator => self: RepositoryService & AccountService & ReferrerAuthenticator & OwnerAuthenticator =>
/* /*
* i. List repository collaborators * i. List repository collaborators

View File

@@ -21,7 +21,7 @@ import scala.math.min
import scala.util.Using import scala.util.Using
trait ApiRepositoryCommitControllerBase extends ControllerBase { trait ApiRepositoryCommitControllerBase extends ControllerBase {
self: AccountService with CommitsService with ProtectedBranchService with ReferrerAuthenticator => self: AccountService & CommitsService & ProtectedBranchService & ReferrerAuthenticator =>
/* /*
* i. List commits on a repository * i. List commits on a repository
* https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository * https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository

View File

@@ -12,7 +12,7 @@ import org.eclipse.jgit.api.Git
import scala.util.Using import scala.util.Using
trait ApiRepositoryContentsControllerBase extends ControllerBase { trait ApiRepositoryContentsControllerBase extends ControllerBase {
self: ReferrerAuthenticator with WritableUsersAuthenticator with RepositoryCommitFileService => self: ReferrerAuthenticator & WritableUsersAuthenticator & RepositoryCommitFileService =>
/** /**
* i. Get a repository README * i. Get a repository README

View File

@@ -15,16 +15,9 @@ import scala.concurrent.duration.Duration
import scala.util.Using import scala.util.Using
trait ApiRepositoryControllerBase extends ControllerBase { trait ApiRepositoryControllerBase extends ControllerBase {
self: RepositoryService self: RepositoryService & ApiGitReferenceControllerBase & RepositoryCreationService & AccountService &
with ApiGitReferenceControllerBase OwnerAuthenticator & UsersAuthenticator & GroupManagerAuthenticator & ReferrerAuthenticator &
with RepositoryCreationService ReadableUsersAuthenticator & WritableUsersAuthenticator =>
with AccountService
with OwnerAuthenticator
with UsersAuthenticator
with GroupManagerAuthenticator
with ReferrerAuthenticator
with ReadableUsersAuthenticator
with WritableUsersAuthenticator =>
/** /**
* i. List your repositories * i. List your repositories

View File

@@ -7,7 +7,7 @@ import gitbucket.core.util.Implicits._
import gitbucket.core.util.{JGitUtil, ReferrerAuthenticator, WritableUsersAuthenticator} import gitbucket.core.util.{JGitUtil, ReferrerAuthenticator, WritableUsersAuthenticator}
trait ApiRepositoryStatusControllerBase extends ControllerBase { trait ApiRepositoryStatusControllerBase extends ControllerBase {
self: AccountService with CommitStatusService with ReferrerAuthenticator with WritableUsersAuthenticator => self: AccountService & CommitStatusService & ReferrerAuthenticator & WritableUsersAuthenticator =>
/* /*
* i. Create a status * i. Create a status

View File

@@ -8,7 +8,7 @@ import gitbucket.core.util.Implicits._
import org.scalatra.NoContent import org.scalatra.NoContent
trait ApiRepositoryWebhookControllerBase extends ControllerBase { trait ApiRepositoryWebhookControllerBase extends ControllerBase {
self: RepositoryService with WebHookService with ReferrerAuthenticator with WritableUsersAuthenticator => self: RepositoryService & WebHookService & ReferrerAuthenticator & WritableUsersAuthenticator =>
/* /*
* i. List repository webhooks * i. List repository webhooks

View File

@@ -8,7 +8,7 @@ import gitbucket.core.util.StringUtil._
import org.scalatra.NoContent import org.scalatra.NoContent
trait ApiUserControllerBase extends ControllerBase { trait ApiUserControllerBase extends ControllerBase {
self: RepositoryService with AccountService with AdminAuthenticator with UsersAuthenticator => self: RepositoryService & AccountService & AdminAuthenticator & UsersAuthenticator =>
/** /**
* i. Get a single user * i. Get a single user

View File

@@ -16,7 +16,7 @@ import gitbucket.core.util.{FileUtil, StringUtil}
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
trait CommitsService { trait CommitsService {
self: ActivityService with PullRequestService with WebHookPullRequestReviewCommentService => self: ActivityService & PullRequestService & WebHookPullRequestReviewCommentService =>
def getCommitComments(owner: String, repository: String, commitId: String, includePullRequest: Boolean)(implicit def getCommitComments(owner: String, repository: String, commitId: String, includePullRequest: Boolean)(implicit
s: Session s: Session

View File

@@ -16,12 +16,8 @@ import gitbucket.core.service.RepositoryService.RepositoryInfo
import gitbucket.core.util.Implicits._ import gitbucket.core.util.Implicits._
trait HandleCommentService { trait HandleCommentService {
self: RepositoryService self: RepositoryService & IssuesService & ActivityService & WebHookService & WebHookIssueCommentService &
with IssuesService WebHookPullRequestService =>
with ActivityService
with WebHookService
with WebHookIssueCommentService
with WebHookPullRequestService =>
/** /**
* @see [[https://github.com/gitbucket/gitbucket/wiki/CommentAction]] * @see [[https://github.com/gitbucket/gitbucket/wiki/CommentAction]]

View File

@@ -10,7 +10,7 @@ import gitbucket.core.util.Implicits._
trait IssueCreationService { trait IssueCreationService {
self: RepositoryService with WebHookIssueCommentService with LabelsService with IssuesService with ActivityService => self: RepositoryService & WebHookIssueCommentService & LabelsService & IssuesService & ActivityService =>
def createIssue( def createIssue(
repository: RepositoryInfo, repository: RepositoryInfo,

View File

@@ -26,7 +26,7 @@ import gitbucket.core.plugin.PluginRegistry
import scala.jdk.CollectionConverters._ import scala.jdk.CollectionConverters._
trait IssuesService { trait IssuesService {
self: AccountService with RepositoryService with LabelsService with PrioritiesService with MilestonesService => self: AccountService & RepositoryService & LabelsService & PrioritiesService & MilestonesService =>
import IssuesService._ import IssuesService._
def getIssue(owner: String, repository: String, issueId: String)(implicit s: Session) = def getIssue(owner: String, repository: String, issueId: String)(implicit s: Session) =

View File

@@ -23,13 +23,8 @@ import scala.jdk.CollectionConverters._
import scala.util.Using import scala.util.Using
trait MergeService { trait MergeService {
self: AccountService self: AccountService & ActivityService & IssuesService & RepositoryService & PullRequestService &
with ActivityService WebHookPullRequestService & WebHookService =>
with IssuesService
with RepositoryService
with PullRequestService
with WebHookPullRequestService
with WebHookService =>
import MergeService._ import MergeService._

View File

@@ -25,13 +25,8 @@ import scala.jdk.CollectionConverters.*
import scala.util.Using import scala.util.Using
trait PullRequestService { trait PullRequestService {
self: IssuesService self: IssuesService & CommitsService & WebHookService & WebHookPullRequestService & RepositoryService & MergeService &
with CommitsService ActivityService =>
with WebHookService
with WebHookPullRequestService
with RepositoryService
with MergeService
with ActivityService =>
import PullRequestService.* import PullRequestService.*
def getPullRequest(owner: String, repository: String, issueId: Int)(implicit def getPullRequest(owner: String, repository: String, issueId: Int)(implicit

View File

@@ -8,7 +8,7 @@ import gitbucket.core.model.Profile.dateColumnType
import gitbucket.core.util.JGitUtil import gitbucket.core.util.JGitUtil
trait ReleaseService { trait ReleaseService {
self: AccountService with RepositoryService => self: AccountService & RepositoryService =>
def createReleaseAsset( def createReleaseAsset(
owner: String, owner: String,

View File

@@ -17,12 +17,8 @@ import org.eclipse.jgit.transport.{ReceiveCommand, ReceivePack}
import scala.util.Using import scala.util.Using
trait RepositoryCommitFileService { trait RepositoryCommitFileService {
self: AccountService self: AccountService & ActivityService & IssuesService & PullRequestService & WebHookPullRequestService &
with ActivityService RepositoryService =>
with IssuesService
with PullRequestService
with WebHookPullRequestService
with RepositoryService =>
/** /**
* Create multiple files by callback function. * Create multiple files by callback function.

View File

@@ -46,12 +46,7 @@ object RepositoryCreationService {
} }
trait RepositoryCreationService { trait RepositoryCreationService {
self: AccountService self: AccountService & RepositoryService & LabelsService & WikiService & ActivityService & PrioritiesService =>
with RepositoryService
with LabelsService
with WikiService
with ActivityService
with PrioritiesService =>
def canCreateRepository(repositoryOwner: String, loginAccount: Account)(implicit session: Session): Boolean = { def canCreateRepository(repositoryOwner: String, loginAccount: Account)(implicit session: Session): Boolean = {
repositoryOwner == loginAccount.userName || getGroupsByUserName(loginAccount.userName) repositoryOwner == loginAccount.userName || getGroupsByUserName(loginAccount.userName)

View File

@@ -367,7 +367,7 @@ trait WebHookService {
} }
trait WebHookPullRequestService extends WebHookService { trait WebHookPullRequestService extends WebHookService {
self: AccountService with RepositoryService with PullRequestService with IssuesService => self: AccountService & RepositoryService & PullRequestService & IssuesService =>
import WebHookService._ import WebHookService._
// https://developer.github.com/v3/activity/events/types/#issuesevent // https://developer.github.com/v3/activity/events/types/#issuesevent
@@ -513,7 +513,7 @@ trait WebHookPullRequestService extends WebHookService {
} }
trait WebHookPullRequestReviewCommentService extends WebHookService { trait WebHookPullRequestReviewCommentService extends WebHookService {
self: AccountService with RepositoryService with PullRequestService with IssuesService with CommitsService => self: AccountService & RepositoryService & PullRequestService & IssuesService & CommitsService =>
def callPullRequestReviewCommentWebHook( def callPullRequestReviewCommentWebHook(
action: String, action: String,
comment: CommitComment, comment: CommitComment,
@@ -561,7 +561,7 @@ trait WebHookPullRequestReviewCommentService extends WebHookService {
} }
trait WebHookIssueCommentService extends WebHookPullRequestService { trait WebHookIssueCommentService extends WebHookPullRequestService {
self: AccountService with RepositoryService with PullRequestService with IssuesService => self: AccountService & RepositoryService & PullRequestService & IssuesService =>
import WebHookService._ import WebHookService._
def callIssueCommentWebHook( def callIssueCommentWebHook(

View File

@@ -92,7 +92,7 @@ abstract class GitCommand extends Command with ServerSessionAware {
} }
abstract class DefaultGitCommand(val owner: String, val repoName: String) extends GitCommand { abstract class DefaultGitCommand(val owner: String, val repoName: String) extends GitCommand {
self: RepositoryService with AccountService with DeployKeyService => self: RepositoryService & AccountService & DeployKeyService =>
protected def userName(authType: AuthType): String = { protected def userName(authType: AuthType): String = {
authType match { authType match {

View File

@@ -25,7 +25,7 @@ trait OneselfAuthenticator { self: ControllerBase =>
/** /**
* Allows only the repository owner and administrators. * Allows only the repository owner and administrators.
*/ */
trait OwnerAuthenticator { self: ControllerBase with RepositoryService with AccountService => trait OwnerAuthenticator { self: ControllerBase & RepositoryService & AccountService =>
protected def ownerOnly(action: (RepositoryInfo) => Any) = { authenticate(action) } protected def ownerOnly(action: (RepositoryInfo) => Any) = { authenticate(action) }
protected def ownerOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { authenticate(action(form, _)) } protected def ownerOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { authenticate(action(form, _)) }
@@ -82,7 +82,7 @@ trait AdminAuthenticator { self: ControllerBase =>
/** /**
* Allows only guests and signed in users who can access the repository. * Allows only guests and signed in users who can access the repository.
*/ */
trait ReferrerAuthenticator { self: ControllerBase with RepositoryService with AccountService => trait ReferrerAuthenticator { self: ControllerBase & RepositoryService & AccountService =>
protected def referrersOnly(action: (RepositoryInfo) => Any) = { authenticate(action) } protected def referrersOnly(action: (RepositoryInfo) => Any) = { authenticate(action) }
protected def referrersOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { authenticate(action(form, _)) } protected def referrersOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { authenticate(action(form, _)) }
@@ -102,7 +102,7 @@ trait ReferrerAuthenticator { self: ControllerBase with RepositoryService with A
/** /**
* Allows only signed in users who have read permission for the repository. * Allows only signed in users who have read permission for the repository.
*/ */
trait ReadableUsersAuthenticator { self: ControllerBase with RepositoryService with AccountService => trait ReadableUsersAuthenticator { self: ControllerBase & RepositoryService & AccountService =>
protected def readableUsersOnly(action: (RepositoryInfo) => Any) = { authenticate(action) } protected def readableUsersOnly(action: (RepositoryInfo) => Any) = { authenticate(action) }
protected def readableUsersOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { protected def readableUsersOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => {
authenticate(action(form, _)) authenticate(action(form, _))
@@ -124,7 +124,7 @@ trait ReadableUsersAuthenticator { self: ControllerBase with RepositoryService w
/** /**
* Allows only signed in users who have write permission for the repository. * Allows only signed in users who have write permission for the repository.
*/ */
trait WritableUsersAuthenticator { self: ControllerBase with RepositoryService with AccountService => trait WritableUsersAuthenticator { self: ControllerBase & RepositoryService & AccountService =>
protected def writableUsersOnly(action: (RepositoryInfo) => Any) = { authenticate(action) } protected def writableUsersOnly(action: (RepositoryInfo) => Any) = { authenticate(action) }
protected def writableUsersOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { protected def writableUsersOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => {
authenticate(action(form, _)) authenticate(action(form, _))
@@ -151,7 +151,7 @@ trait WritableUsersAuthenticator { self: ControllerBase with RepositoryService w
/** /**
* Allows only the group managers. * Allows only the group managers.
*/ */
trait GroupManagerAuthenticator { self: ControllerBase with AccountService => trait GroupManagerAuthenticator { self: ControllerBase & AccountService =>
protected def managersOnly(action: => Any) = { authenticate(action) } protected def managersOnly(action: => Any) = { authenticate(action) }
protected def managersOnly[T](action: T => Any) = (form: T) => { authenticate(action(form)) } protected def managersOnly[T](action: T => Any) = (form: T) => { authenticate(action(form)) }