mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 23:15:49 +01:00
Merge branch 'master' of https://github.com/takezoe/gitbucket
Conflicts: src/main/scala/app/IssuesController.scala
This commit is contained in:
@@ -3,31 +3,23 @@ package app
|
|||||||
import jp.sf.amateras.scalatra.forms._
|
import jp.sf.amateras.scalatra.forms._
|
||||||
|
|
||||||
import service._
|
import service._
|
||||||
import util.{WritableRepositoryAuthenticator, ReadableRepositoryAuthenticator, UsersOnlyAuthenticator}
|
import util.UsersOnlyAuthenticator
|
||||||
|
|
||||||
class IssuesController extends IssuesControllerBase
|
class IssuesController extends IssuesControllerBase
|
||||||
with IssuesService with RepositoryService with AccountService with LabelsService with MilestonesService
|
with IssuesService with RepositoryService with AccountService with LabelsService with MilestonesService
|
||||||
with UsersOnlyAuthenticator with ReadableRepositoryAuthenticator with WritableRepositoryAuthenticator
|
with UsersOnlyAuthenticator
|
||||||
|
|
||||||
trait IssuesControllerBase extends ControllerBase {
|
trait IssuesControllerBase extends ControllerBase {
|
||||||
self: IssuesService with RepositoryService with LabelsService with MilestonesService
|
self: IssuesService with RepositoryService with LabelsService with MilestonesService
|
||||||
with UsersOnlyAuthenticator with ReadableRepositoryAuthenticator with WritableRepositoryAuthenticator =>
|
with UsersOnlyAuthenticator =>
|
||||||
|
|
||||||
case class IssueForm(title: String, content: Option[String])
|
case class IssueForm(title: String, content: Option[String])
|
||||||
|
|
||||||
case class MilestoneForm(title: String, description: Option[String], dueDate: Option[java.util.Date])
|
|
||||||
|
|
||||||
val form = mapping(
|
val form = mapping(
|
||||||
"title" -> trim(label("Title", text(required))),
|
"title" -> trim(label("Title", text(required))),
|
||||||
"content" -> trim(optional(text()))
|
"content" -> trim(optional(text()))
|
||||||
)(IssueForm.apply)
|
)(IssueForm.apply)
|
||||||
|
|
||||||
val milestoneForm = mapping(
|
|
||||||
"title" -> trim(label("Title", text(required, maxlength(100)))),
|
|
||||||
"description" -> trim(label("Description", optional(text()))),
|
|
||||||
"dueDate" -> trim(label("Due Date", optional(date())))
|
|
||||||
)(MilestoneForm.apply)
|
|
||||||
|
|
||||||
get("/:owner/:repository/issues"){
|
get("/:owner/:repository/issues"){
|
||||||
val owner = params("owner")
|
val owner = params("owner")
|
||||||
val repository = params("repository")
|
val repository = params("repository")
|
||||||
@@ -58,10 +50,12 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
} getOrElse NotFound
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO requires users only and redable repository checking
|
||||||
get("/:owner/:repository/issues/new")( usersOnly {
|
get("/:owner/:repository/issues/new")( usersOnly {
|
||||||
issues.html.issueedit(getRepository(params("owner"), params("repository"), baseUrl).get)
|
issues.html.issueedit(getRepository(params("owner"), params("repository"), baseUrl).get)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO requires users only and redable repository checking
|
||||||
post("/:owner/:repository/issues", form)( usersOnly { form =>
|
post("/:owner/:repository/issues", form)( usersOnly { form =>
|
||||||
val owner = params("owner")
|
val owner = params("owner")
|
||||||
val repository = params("repository")
|
val repository = params("repository")
|
||||||
@@ -70,6 +64,7 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
saveIssue(owner, repository, context.loginAccount.get.userName, form.title, form.content)))
|
saveIssue(owner, repository, context.loginAccount.get.userName, form.title, form.content)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// TODO requires users only and redable repository checking
|
||||||
post("/:owner/:repository/issue_comments")( usersOnly {
|
post("/:owner/:repository/issue_comments")( usersOnly {
|
||||||
val owner = params("owner")
|
val owner = params("owner")
|
||||||
val repository = params("repository")
|
val repository = params("repository")
|
||||||
|
|||||||
Reference in New Issue
Block a user