mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-08 01:37:34 +02:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a79f105eea | ||
|
|
b916595da3 | ||
|
|
90b63090cc | ||
|
|
345685ed7c | ||
|
|
1d9fe5770e | ||
|
|
ec307b84d3 | ||
|
|
5d7346db91 | ||
|
|
443498433d | ||
|
|
a58ce07736 | ||
|
|
1903c3990c | ||
|
|
90441c8eec | ||
|
|
601919bcc6 | ||
|
|
6903b096f5 | ||
|
|
e44fed09fa | ||
|
|
8ed0c8a170 | ||
|
|
31118ac285 | ||
|
|
c851b7582f | ||
|
|
102a02d527 | ||
|
|
1968bf871a | ||
|
|
5cd4e48173 | ||
|
|
111d212cb5 | ||
|
|
d648d34393 | ||
|
|
bbaa5b38e7 | ||
|
|
3c50a78be2 | ||
|
|
82cc1fa530 | ||
|
|
8c0581973e | ||
|
|
bfa15f5d75 | ||
|
|
57e87b581d | ||
|
|
6431d25409 | ||
|
|
ff3205b6c7 |
12
README.md
12
README.md
@@ -63,6 +63,18 @@ Support
|
||||
|
||||
Release Notes
|
||||
--------
|
||||
### 4.0 - 30 Apr 2016
|
||||
|
||||
- MySQL and PostgreSQL support
|
||||
- Data export and import
|
||||
- Migration system has been switched to [solidbase](https://github.com/gitbucket/solidbase)
|
||||
|
||||
### 3.14 - 30 Apr 2016
|
||||
|
||||
- File attachment and search for wiki pages
|
||||
- New extension points to add menus
|
||||
- Content-Type of webhooks has been choosable
|
||||
|
||||
### 3.13 - 1 Apr 2016
|
||||
- Refresh user interface for wide screen
|
||||
- Add `pull_request` key in list issues API for pull requests
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
val Organization = "gitbucket"
|
||||
val Name = "gitbucket"
|
||||
val GitBucketVersion = "3.13.0"
|
||||
val GitBucketVersion = "3.14.0"
|
||||
val ScalatraVersion = "2.4.0"
|
||||
val JettyVersion = "9.3.6.v20151106"
|
||||
|
||||
@@ -26,7 +26,7 @@ libraryDependencies ++= Seq(
|
||||
"org.json4s" %% "json4s-jackson" % "3.3.0",
|
||||
"io.github.gitbucket" %% "scalatra-forms" % "1.0.0",
|
||||
"commons-io" % "commons-io" % "2.4",
|
||||
"io.github.gitbucket" % "markedj" % "1.0.7",
|
||||
"io.github.gitbucket" % "markedj" % "1.0.8",
|
||||
"org.apache.commons" % "commons-compress" % "1.10",
|
||||
"org.apache.commons" % "commons-email" % "1.4",
|
||||
"org.apache.httpcomponents" % "httpclient" % "4.5.1",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>1.0-beta-6</version>
|
||||
<version>2.10</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
|
||||
@@ -1 +1 @@
|
||||
ALTER TABLE WEB_HOOK ADD COLUMN TOKEN VARCHAR(100);
|
||||
ALTER TABLE WEB_HOOK ADD COLUMN TOKEN VARCHAR(100);
|
||||
|
||||
3
src/main/resources/update/3_14.sql
Normal file
3
src/main/resources/update/3_14.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE WEB_HOOK ADD COLUMN CTYPE VARCHAR(10);
|
||||
|
||||
UPDATE WEB_HOOK SET CTYPE = 'form';
|
||||
@@ -1,18 +1,24 @@
|
||||
package gitbucket.core.controller
|
||||
|
||||
import gitbucket.core.util.{Keys, FileUtil}
|
||||
import gitbucket.core.model.Account
|
||||
import gitbucket.core.service.{AccountService, RepositoryService}
|
||||
import gitbucket.core.servlet.Database
|
||||
import gitbucket.core.util._
|
||||
import gitbucket.core.util.ControlUtil._
|
||||
import gitbucket.core.util.Directory._
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.dircache.DirCache
|
||||
import org.eclipse.jgit.lib.{FileMode, Constants}
|
||||
import org.scalatra._
|
||||
import org.scalatra.servlet.{MultipartConfig, FileUploadSupport, FileItem}
|
||||
import org.apache.commons.io.FileUtils
|
||||
import org.apache.commons.io.{IOUtils, FileUtils}
|
||||
|
||||
/**
|
||||
* Provides Ajax based file upload functionality.
|
||||
*
|
||||
* This servlet saves uploaded file.
|
||||
*/
|
||||
class FileUploadController extends ScalatraServlet with FileUploadSupport {
|
||||
class FileUploadController extends ScalatraServlet with FileUploadSupport with RepositoryService with AccountService {
|
||||
|
||||
configureMultipartHandling(MultipartConfig(maxFileSize = Some(3 * 1024 * 1024)))
|
||||
|
||||
@@ -31,6 +37,54 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport {
|
||||
}, FileUtil.isUploadableType)
|
||||
}
|
||||
|
||||
post("/wiki/:owner/:repository"){
|
||||
// Don't accept not logged-in users
|
||||
session.get(Keys.Session.LoginAccount).collect { case loginAccount: Account =>
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
|
||||
// Check whether logged-in user is collaborator
|
||||
collaboratorsOnly(owner, repository, loginAccount){
|
||||
execute({ (file, fileId) =>
|
||||
val fileName = file.getName
|
||||
LockUtil.lock(s"${owner}/${repository}/wiki") {
|
||||
using(Git.open(Directory.getWikiRepositoryDir(owner, repository))) { git =>
|
||||
val builder = DirCache.newInCore.builder()
|
||||
val inserter = git.getRepository.newObjectInserter()
|
||||
val headId = git.getRepository.resolve(Constants.HEAD + "^{commit}")
|
||||
|
||||
if(headId != null){
|
||||
JGitUtil.processTree(git, headId){ (path, tree) =>
|
||||
if(path != fileName){
|
||||
builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val bytes = IOUtils.toByteArray(file.getInputStream)
|
||||
builder.add(JGitUtil.createDirCacheEntry(fileName, FileMode.REGULAR_FILE, inserter.insert(Constants.OBJ_BLOB, bytes)))
|
||||
builder.finish()
|
||||
|
||||
val newHeadId = JGitUtil.createNewCommit(git, inserter, headId, builder.getDirCache.writeTree(inserter),
|
||||
Constants.HEAD, loginAccount.userName, loginAccount.mailAddress, s"Uploaded ${fileName}")
|
||||
|
||||
fileName
|
||||
}
|
||||
}
|
||||
}, FileUtil.isImage)
|
||||
}
|
||||
} getOrElse BadRequest
|
||||
}
|
||||
|
||||
private def collaboratorsOnly(owner: String, repository: String, loginAccount: Account)(action: => Any): Any = {
|
||||
implicit val session = Database.getSession(request)
|
||||
loginAccount match {
|
||||
case x if(x.isAdmin) => action
|
||||
case x if(getCollaborators(owner, repository).contains(x.userName)) => action
|
||||
case _ => BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
private def execute(f: (FileItem, String) => Unit, mimeTypeChcker: (String) => Boolean) = fileParams.get("file") match {
|
||||
case Some(file) if(mimeTypeChcker(file.name)) =>
|
||||
defining(FileUtil.generateFileId){ fileId =>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package gitbucket.core.controller
|
||||
|
||||
import gitbucket.core.api._
|
||||
import gitbucket.core.helper.xml
|
||||
import gitbucket.core.model.Account
|
||||
import gitbucket.core.service.{RepositoryService, ActivityService, AccountService, RepositorySearchService, IssuesService}
|
||||
import gitbucket.core.service._
|
||||
import gitbucket.core.util.Implicits._
|
||||
import gitbucket.core.util.ControlUtil._
|
||||
import gitbucket.core.util.{LDAPUtil, Keys, UsersAuthenticator, ReferrerAuthenticator, StringUtil}
|
||||
@@ -138,13 +137,21 @@ trait IndexControllerBase extends ControllerBase {
|
||||
|
||||
target.toLowerCase match {
|
||||
case "issue" => gitbucket.core.search.html.issues(
|
||||
searchIssues(repository.owner, repository.name, query),
|
||||
countFiles(repository.owner, repository.name, query),
|
||||
searchIssues(repository.owner, repository.name, query),
|
||||
countWikiPages(repository.owner, repository.name, query),
|
||||
query, page, repository)
|
||||
|
||||
case "wiki" => gitbucket.core.search.html.wiki(
|
||||
countFiles(repository.owner, repository.name, query),
|
||||
countIssues(repository.owner, repository.name, query),
|
||||
searchWikiPages(repository.owner, repository.name, query),
|
||||
query, page, repository)
|
||||
|
||||
case _ => gitbucket.core.search.html.code(
|
||||
searchFiles(repository.owner, repository.name, query),
|
||||
countIssues(repository.owner, repository.name, query),
|
||||
countWikiPages(repository.owner, repository.name, query),
|
||||
query, page, repository)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.scalatra.i18n.Messages
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.lib.Constants
|
||||
import org.eclipse.jgit.lib.ObjectId
|
||||
import gitbucket.core.model.WebHookContentType
|
||||
|
||||
|
||||
class RepositorySettingsController extends RepositorySettingsControllerBase
|
||||
@@ -49,13 +50,16 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
||||
)(CollaboratorForm.apply)
|
||||
|
||||
// for web hook url addition
|
||||
case class WebHookForm(url: String, events: Set[WebHook.Event], token: Option[String])
|
||||
case class WebHookForm(url: String, events: Set[WebHook.Event], ctype: WebHookContentType, token: Option[String])
|
||||
|
||||
def webHookForm(update:Boolean) = mapping(
|
||||
"url" -> trim(label("url", text(required, webHook(update)))),
|
||||
"events" -> webhookEvents,
|
||||
"ctype" -> label("ctype", text()),
|
||||
"token" -> optional(trim(label("token", text(maxlength(100)))))
|
||||
)(WebHookForm.apply)
|
||||
)(
|
||||
(url, events, ctype, token) => WebHookForm(url, events, WebHookContentType.valueOf(ctype), token)
|
||||
)
|
||||
|
||||
// for transfer ownership
|
||||
case class TransferOwnerShipForm(newOwner: String)
|
||||
@@ -183,7 +187,7 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
||||
* Display the web hook edit page.
|
||||
*/
|
||||
get("/:owner/:repository/settings/hooks/new")(ownerOnly { repository =>
|
||||
val webhook = WebHook(repository.owner, repository.name, "", None)
|
||||
val webhook = WebHook(repository.owner, repository.name, "", WebHookContentType.FORM, None)
|
||||
html.edithooks(webhook, Set(WebHook.Push), repository, flash.get("info"), true)
|
||||
})
|
||||
|
||||
@@ -191,7 +195,7 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
||||
* Add the web hook URL.
|
||||
*/
|
||||
post("/:owner/:repository/settings/hooks/new", webHookForm(false))(ownerOnly { (form, repository) =>
|
||||
addWebHook(repository.owner, repository.name, form.url, form.events, form.token)
|
||||
addWebHook(repository.owner, repository.name, form.url, form.events, form.ctype, form.token)
|
||||
flash += "info" -> s"Webhook ${form.url} created"
|
||||
redirect(s"/${repository.owner}/${repository.name}/settings/hooks")
|
||||
})
|
||||
@@ -221,7 +225,8 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
||||
|
||||
val url = params("url")
|
||||
val token = Some(params("token"))
|
||||
val dummyWebHookInfo = WebHook(repository.owner, repository.name, url, token)
|
||||
val ctype = WebHookContentType.valueOf(params("ctype"))
|
||||
val dummyWebHookInfo = WebHook(repository.owner, repository.name, url, ctype, token)
|
||||
val dummyPayload = {
|
||||
val ownerAccount = getAccountByUserName(repository.owner).get
|
||||
val commits = if(repository.commitCount == 0) List.empty else git.log
|
||||
@@ -280,7 +285,7 @@ trait RepositorySettingsControllerBase extends ControllerBase {
|
||||
* Update web hook settings.
|
||||
*/
|
||||
post("/:owner/:repository/settings/hooks/edit", webHookForm(true))(ownerOnly { (form, repository) =>
|
||||
updateWebHook(repository.owner, repository.name, form.url, form.events, form.token)
|
||||
updateWebHook(repository.owner, repository.name, form.url, form.events, form.ctype, form.token)
|
||||
flash += "info" -> s"webhook ${form.url} updated"
|
||||
redirect(s"/${repository.owner}/${repository.name}/settings/hooks")
|
||||
})
|
||||
|
||||
@@ -12,7 +12,8 @@ import org.eclipse.jgit.api.Git
|
||||
import org.scalatra.i18n.Messages
|
||||
|
||||
class WikiController extends WikiControllerBase
|
||||
with WikiService with RepositoryService with AccountService with ActivityService with CollaboratorsAuthenticator with ReferrerAuthenticator
|
||||
with WikiService with RepositoryService with AccountService with ActivityService
|
||||
with CollaboratorsAuthenticator with ReferrerAuthenticator
|
||||
|
||||
trait WikiControllerBase extends ControllerBase {
|
||||
self: WikiService with RepositoryService with ActivityService with CollaboratorsAuthenticator with ReferrerAuthenticator =>
|
||||
|
||||
@@ -3,21 +3,42 @@ package gitbucket.core.model
|
||||
trait WebHookComponent extends TemplateComponent { self: Profile =>
|
||||
import profile.simple._
|
||||
|
||||
implicit val whContentTypeColumnType = MappedColumnType.base[WebHookContentType, String](whct => whct.code , code => WebHookContentType.valueOf(code))
|
||||
|
||||
lazy val WebHooks = TableQuery[WebHooks]
|
||||
|
||||
class WebHooks(tag: Tag) extends Table[WebHook](tag, "WEB_HOOK") with BasicTemplate {
|
||||
val url = column[String]("URL")
|
||||
val token = column[Option[String]]("TOKEN", O.Nullable)
|
||||
def * = (userName, repositoryName, url, token) <> ((WebHook.apply _).tupled, WebHook.unapply)
|
||||
val ctype = column[WebHookContentType]("CTYPE", O.NotNull)
|
||||
def * = (userName, repositoryName, url, ctype, token) <> ((WebHook.apply _).tupled, WebHook.unapply)
|
||||
|
||||
def byPrimaryKey(owner: String, repository: String, url: String) = byRepository(owner, repository) && (this.url === url.bind)
|
||||
}
|
||||
}
|
||||
|
||||
case class WebHookContentType(val code: String, val ctype: String)
|
||||
|
||||
object WebHookContentType {
|
||||
object JSON extends WebHookContentType("json", "application/json")
|
||||
|
||||
object FORM extends WebHookContentType("form", "application/x-www-form-urlencoded")
|
||||
|
||||
val values: Vector[WebHookContentType] = Vector(JSON, FORM)
|
||||
|
||||
private val map: Map[String, WebHookContentType] = values.map(enum => enum.code -> enum).toMap
|
||||
|
||||
def apply(code: String): WebHookContentType = map(code)
|
||||
|
||||
def valueOf(code: String): WebHookContentType = map(code)
|
||||
def valueOpt(code: String): Option[WebHookContentType] = map.get(code)
|
||||
}
|
||||
|
||||
case class WebHook(
|
||||
userName: String,
|
||||
repositoryName: String,
|
||||
url: String,
|
||||
ctype: WebHookContentType,
|
||||
token: Option[String]
|
||||
)
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package gitbucket.core.plugin
|
||||
|
||||
import javax.servlet.ServletContext
|
||||
import gitbucket.core.controller.ControllerBase
|
||||
import gitbucket.core.controller.{Context, ControllerBase}
|
||||
import gitbucket.core.model.Account
|
||||
import gitbucket.core.service.RepositoryService.RepositoryInfo
|
||||
import gitbucket.core.service.SystemSettingsService.SystemSettings
|
||||
import gitbucket.core.util.ControlUtil._
|
||||
import gitbucket.core.util.Version
|
||||
|
||||
/**
|
||||
* Trait for define plugin interface.
|
||||
* To provide plugin, put Plugin class which mixed in this trait into the package root.
|
||||
* To provide a plugin, put a Plugin class which extends this class into the package root.
|
||||
*/
|
||||
trait Plugin {
|
||||
abstract class Plugin {
|
||||
|
||||
val pluginId: String
|
||||
val pluginName: String
|
||||
@@ -77,6 +79,76 @@ trait Plugin {
|
||||
*/
|
||||
def receiveHooks(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[ReceiveHook] = Nil
|
||||
|
||||
/**
|
||||
* Override to add global menus.
|
||||
*/
|
||||
val globalMenus: Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add global menus.
|
||||
*/
|
||||
def globalMenus(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add repository menus.
|
||||
*/
|
||||
val repositoryMenus: Seq[(RepositoryInfo, Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add repository menus.
|
||||
*/
|
||||
def repositoryMenus(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(RepositoryInfo, Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add repository setting tabs.
|
||||
*/
|
||||
val repositorySettingTabs: Seq[(RepositoryInfo, Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add repository setting tabs.
|
||||
*/
|
||||
def repositorySettingTabs(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(RepositoryInfo, Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add profile tabs.
|
||||
*/
|
||||
val profileTabs: Seq[(Account, Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add profile tabs.
|
||||
*/
|
||||
def profileTabs(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(Account, Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add system setting menus.
|
||||
*/
|
||||
val systemSettingMenus: Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add system setting menus.
|
||||
*/
|
||||
def systemSettingMenus(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add account setting menus.
|
||||
*/
|
||||
val accountSettingMenus: Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add account setting menus.
|
||||
*/
|
||||
def accountSettingMenus(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add dashboard tabs.
|
||||
*/
|
||||
val dashboardTabs: Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* Override to add dashboard tabs.
|
||||
*/
|
||||
def dashboardTabs(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(Context) => Option[Link]] = Nil
|
||||
|
||||
/**
|
||||
* This method is invoked in initialization of plugin system.
|
||||
* Register plugin functionality to PluginRegistry.
|
||||
@@ -100,6 +172,27 @@ trait Plugin {
|
||||
(receiveHooks ++ receiveHooks(registry, context, settings)).foreach { receiveHook =>
|
||||
registry.addReceiveHook(receiveHook)
|
||||
}
|
||||
(globalMenus ++ globalMenus(registry, context, settings)).foreach { globalMenu =>
|
||||
registry.addGlobalMenu(globalMenu)
|
||||
}
|
||||
(repositoryMenus ++ repositoryMenus(registry, context, settings)).foreach { repositoryMenu =>
|
||||
registry.addRepositoryMenu(repositoryMenu)
|
||||
}
|
||||
(repositorySettingTabs ++ repositorySettingTabs(registry, context, settings)).foreach { repositorySettingTab =>
|
||||
registry.addRepositorySettingTab(repositorySettingTab)
|
||||
}
|
||||
(profileTabs ++ profileTabs(registry, context, settings)).foreach { profileTab =>
|
||||
registry.addProfileTab(profileTab)
|
||||
}
|
||||
(systemSettingMenus ++ systemSettingMenus(registry, context, settings)).foreach { systemSettingMenu =>
|
||||
registry.addSystemSettingMenu(systemSettingMenu)
|
||||
}
|
||||
(accountSettingMenus ++ accountSettingMenus(registry, context, settings)).foreach { accountSettingMenu =>
|
||||
registry.addAccountSettingMenu(accountSettingMenu)
|
||||
}
|
||||
(dashboardTabs ++ dashboardTabs(registry, context, settings)).foreach { dashboardTab =>
|
||||
registry.addDashboardTab(dashboardTab)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,9 +3,9 @@ package gitbucket.core.plugin
|
||||
import java.io.{File, FilenameFilter, InputStream}
|
||||
import java.net.URLClassLoader
|
||||
import javax.servlet.ServletContext
|
||||
import javax.servlet.http.{HttpServletRequest, HttpServletResponse}
|
||||
|
||||
import gitbucket.core.controller.{Context, ControllerBase}
|
||||
import gitbucket.core.model.Account
|
||||
import gitbucket.core.service.ProtectedBranchService.ProtectedBranchReceiveHook
|
||||
import gitbucket.core.service.RepositoryService.RepositoryInfo
|
||||
import gitbucket.core.service.SystemSettingsService.SystemSettings
|
||||
@@ -33,6 +33,14 @@ class PluginRegistry {
|
||||
private val receiveHooks = new ListBuffer[ReceiveHook]
|
||||
receiveHooks += new ProtectedBranchReceiveHook()
|
||||
|
||||
private val globalMenus = new ListBuffer[(Context) => Option[Link]]
|
||||
private val repositoryMenus = new ListBuffer[(RepositoryInfo, Context) => Option[Link]]
|
||||
private val repositorySettingTabs = new ListBuffer[(RepositoryInfo, Context) => Option[Link]]
|
||||
private val profileTabs = new ListBuffer[(Account, Context) => Option[Link]]
|
||||
private val systemSettingMenus = new ListBuffer[(Context) => Option[Link]]
|
||||
private val accountSettingMenus = new ListBuffer[(Context) => Option[Link]]
|
||||
private val dashboardTabs = new ListBuffer[(Context) => Option[Link]]
|
||||
|
||||
def addPlugin(pluginInfo: PluginInfo): Unit = {
|
||||
plugins += pluginInfo
|
||||
}
|
||||
@@ -107,17 +115,47 @@ class PluginRegistry {
|
||||
|
||||
def getReceiveHooks: Seq[ReceiveHook] = receiveHooks.toSeq
|
||||
|
||||
private case class GlobalAction(
|
||||
method: String,
|
||||
path: String,
|
||||
function: (HttpServletRequest, HttpServletResponse, Context) => Any
|
||||
)
|
||||
def addGlobalMenu(globalMenu: (Context) => Option[Link]): Unit = {
|
||||
globalMenus += globalMenu
|
||||
}
|
||||
|
||||
private case class RepositoryAction(
|
||||
method: String,
|
||||
path: String,
|
||||
function: (HttpServletRequest, HttpServletResponse, Context, RepositoryInfo) => Any
|
||||
)
|
||||
def getGlobalMenus: Seq[(Context) => Option[Link]] = globalMenus.toSeq
|
||||
|
||||
def addRepositoryMenu(repositoryMenu: (RepositoryInfo, Context) => Option[Link]): Unit = {
|
||||
repositoryMenus += repositoryMenu
|
||||
}
|
||||
|
||||
def getRepositoryMenus: Seq[(RepositoryInfo, Context) => Option[Link]] = repositoryMenus.toSeq
|
||||
|
||||
def addRepositorySettingTab(repositorySettingTab: (RepositoryInfo, Context) => Option[Link]): Unit = {
|
||||
repositorySettingTabs += repositorySettingTab
|
||||
}
|
||||
|
||||
def getRepositorySettingTabs: Seq[(RepositoryInfo, Context) => Option[Link]] = repositorySettingTabs.toSeq
|
||||
|
||||
def addProfileTab(profileTab: (Account, Context) => Option[Link]): Unit = {
|
||||
profileTabs += profileTab
|
||||
}
|
||||
|
||||
def getProfileTabs: Seq[(Account, Context) => Option[Link]] = profileTabs.toSeq
|
||||
|
||||
def addSystemSettingMenu(systemSettingMenu: (Context) => Option[Link]): Unit = {
|
||||
systemSettingMenus += systemSettingMenu
|
||||
}
|
||||
|
||||
def getSystemSettingMenus: Seq[(Context) => Option[Link]] = systemSettingMenus.toSeq
|
||||
|
||||
def addAccountSettingMenu(accountSettingMenu: (Context) => Option[Link]): Unit = {
|
||||
accountSettingMenus += accountSettingMenu
|
||||
}
|
||||
|
||||
def getAccountSettingMenus: Seq[(Context) => Option[Link]] = accountSettingMenus.toSeq
|
||||
|
||||
def addDashboardTab(dashboardTab: (Context) => Option[Link]): Unit = {
|
||||
dashboardTabs += dashboardTab
|
||||
}
|
||||
|
||||
def getDashboardTabs: Seq[(Context) => Option[Link]] = dashboardTabs.toSeq
|
||||
|
||||
}
|
||||
|
||||
@@ -201,6 +239,8 @@ object PluginRegistry {
|
||||
|
||||
}
|
||||
|
||||
case class Link(id: String, label: String, path: String, icon: Option[String] = None)
|
||||
|
||||
case class PluginInfo(
|
||||
pluginId: String,
|
||||
pluginName: String,
|
||||
|
||||
@@ -53,7 +53,30 @@ trait RepositorySearchService { self: IssuesService =>
|
||||
}
|
||||
}
|
||||
|
||||
private def searchRepositoryFiles(git: Git, query: String): List[(String, String)] = {
|
||||
def countWikiPages(owner: String, repository: String, query: String): Int =
|
||||
using(Git.open(Directory.getWikiRepositoryDir(owner, repository))){ git =>
|
||||
if(JGitUtil.isEmpty(git)) 0 else searchRepositoryFiles(git, query).length
|
||||
}
|
||||
|
||||
def searchWikiPages(owner: String, repository: String, query: String): List[FileSearchResult] =
|
||||
using(Git.open(Directory.getWikiRepositoryDir(owner, repository))){ git =>
|
||||
if(JGitUtil.isEmpty(git)){
|
||||
Nil
|
||||
} else {
|
||||
val files = searchRepositoryFiles(git, query)
|
||||
val commits = JGitUtil.getLatestCommitFromPaths(git, files.map(_._1), "HEAD")
|
||||
files.map { case (path, text) =>
|
||||
val (highlightText, lineNumber) = getHighlightText(text, query)
|
||||
FileSearchResult(
|
||||
path.replaceFirst("\\.md$", ""),
|
||||
commits(path).getCommitterIdent.getWhen,
|
||||
highlightText,
|
||||
lineNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def searchRepositoryFiles(git: Git, query: String): List[(String, String)] = {
|
||||
val revWalk = new RevWalk(git.getRepository)
|
||||
val objectId = git.getRepository.resolve("HEAD")
|
||||
val revCommit = revWalk.parseCommit(objectId)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package gitbucket.core.service
|
||||
|
||||
import java.io.ByteArrayInputStream
|
||||
|
||||
import fr.brouillard.oss.security.xhub.XHub
|
||||
import fr.brouillard.oss.security.xhub.XHub.{XHubDigest, XHubConverter}
|
||||
import gitbucket.core.api._
|
||||
@@ -12,7 +11,6 @@ import profile.simple._
|
||||
import gitbucket.core.util.JGitUtil.CommitInfo
|
||||
import gitbucket.core.util.RepositoryName
|
||||
import gitbucket.core.service.RepositoryService.RepositoryInfo
|
||||
|
||||
import org.apache.http.NameValuePair
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity
|
||||
import org.apache.http.message.BasicNameValuePair
|
||||
@@ -22,6 +20,8 @@ import org.slf4j.LoggerFactory
|
||||
import scala.concurrent._
|
||||
import org.apache.http.HttpRequest
|
||||
import org.apache.http.HttpResponse
|
||||
import gitbucket.core.model.WebHookContentType
|
||||
import org.apache.http.client.entity.EntityBuilder
|
||||
|
||||
|
||||
trait WebHookService {
|
||||
@@ -52,15 +52,15 @@ trait WebHookService {
|
||||
.map{ case (w,t) => w -> t.event }
|
||||
.list.groupBy(_._1).mapValues(_.map(_._2).toSet).headOption
|
||||
|
||||
def addWebHook(owner: String, repository: String, url :String, events: Set[WebHook.Event], token: Option[String])(implicit s: Session): Unit = {
|
||||
WebHooks insert WebHook(owner, repository, url, token)
|
||||
def addWebHook(owner: String, repository: String, url :String, events: Set[WebHook.Event], ctype: WebHookContentType, token: Option[String])(implicit s: Session): Unit = {
|
||||
WebHooks insert WebHook(owner, repository, url, ctype, token)
|
||||
events.toSet.map{ event: WebHook.Event =>
|
||||
WebHookEvents insert WebHookEvent(owner, repository, url, event)
|
||||
}
|
||||
}
|
||||
|
||||
def updateWebHook(owner: String, repository: String, url :String, events: Set[WebHook.Event], token: Option[String])(implicit s: Session): Unit = {
|
||||
WebHooks.filter(_.byPrimaryKey(owner, repository, url)).map(w => w.token).update(token)
|
||||
def updateWebHook(owner: String, repository: String, url :String, events: Set[WebHook.Event], ctype: WebHookContentType, token: Option[String])(implicit s: Session): Unit = {
|
||||
WebHooks.filter(_.byPrimaryKey(owner, repository, url)).map(w => (w.ctype, w.token)).update((ctype, token))
|
||||
WebHookEvents.filter(_.byWebHook(owner, repository, url)).delete
|
||||
events.toSet.map{ event: WebHook.Event =>
|
||||
WebHookEvents insert WebHookEvent(owner, repository, url, event)
|
||||
@@ -100,19 +100,29 @@ trait WebHookService {
|
||||
val httpClient = HttpClientBuilder.create.addInterceptorLast(itcp).build
|
||||
logger.debug(s"start web hook invocation for ${webHook.url}")
|
||||
val httpPost = new HttpPost(webHook.url)
|
||||
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
logger.info(s"Content-Type: ${webHook.ctype.ctype}")
|
||||
httpPost.addHeader("Content-Type", webHook.ctype.ctype)
|
||||
httpPost.addHeader("X-Github-Event", event.name)
|
||||
httpPost.addHeader("X-Github-Delivery", java.util.UUID.randomUUID().toString)
|
||||
|
||||
val params: java.util.List[NameValuePair] = new java.util.ArrayList()
|
||||
params.add(new BasicNameValuePair("payload", json))
|
||||
def postContent = new UrlEncodedFormEntity(params, "UTF-8")
|
||||
httpPost.setEntity(postContent)
|
||||
|
||||
if (!webHook.token.isEmpty) {
|
||||
// TODO find a better way and see how to extract content from postContent
|
||||
val contentAsBytes = URLEncodedUtils.format(params, "UTF-8").getBytes("UTF-8")
|
||||
httpPost.addHeader("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, webHook.token.orNull, contentAsBytes))
|
||||
webHook.ctype match {
|
||||
case WebHookContentType.FORM => {
|
||||
val params: java.util.List[NameValuePair] = new java.util.ArrayList()
|
||||
params.add(new BasicNameValuePair("payload", json))
|
||||
def postContent = new UrlEncodedFormEntity(params, "UTF-8")
|
||||
httpPost.setEntity(postContent)
|
||||
if (webHook.token.exists(_.trim.nonEmpty)) {
|
||||
// TODO find a better way and see how to extract content from postContent
|
||||
val contentAsBytes = URLEncodedUtils.format(params, "UTF-8").getBytes("UTF-8")
|
||||
httpPost.addHeader("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, webHook.token.get, contentAsBytes))
|
||||
}
|
||||
}
|
||||
case WebHookContentType.JSON => {
|
||||
httpPost.setEntity(EntityBuilder.create().setText(json).build())
|
||||
if (!webHook.token.isEmpty) {
|
||||
httpPost.addHeader("X-Hub-Signature", XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, webHook.token.orNull, json.getBytes("UTF-8")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val res = httpClient.execute(httpPost)
|
||||
|
||||
@@ -21,6 +21,7 @@ object AutoUpdate {
|
||||
* The history of versions. A head of this sequence is the current GitBucket version.
|
||||
*/
|
||||
val versions = Seq(
|
||||
new Version(3, 14),
|
||||
new Version(3, 13),
|
||||
new Version(3, 12),
|
||||
new Version(3, 11),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main(account.userName){
|
||||
<div class="container body">
|
||||
<div style="float: left; width: 250px;">
|
||||
<div class="main-sidebar">
|
||||
<div class="block">
|
||||
<div class="account-image">@avatar(account.userName, 240)</div>
|
||||
<div class="account-fullname">@account.fullName</div>
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div style="margin-left: 260px; overflow: hidden;">
|
||||
<div class="main-content">
|
||||
<ul class="nav nav-tabs" style="margin-bottom: 5px;">
|
||||
<li@if(active == "repositories"){ class="active"}><a href="@url(account.userName)?tab=repositories">Repositories</a></li>
|
||||
@if(account.isGroupAccount){
|
||||
@@ -33,6 +33,11 @@
|
||||
} else {
|
||||
<li@if(active == "activity"){ class="active"}><a href="@url(account.userName)?tab=activity">Public Activity</a></li>
|
||||
}
|
||||
@gitbucket.core.plugin.PluginRegistry().getProfileTabs.map { tab =>
|
||||
@tab(account, context).map { link =>
|
||||
<li@if(active == link.id){ class="active"}><a href="@path/@link.path">@link.label</a></li>
|
||||
}
|
||||
}
|
||||
@if(loginAccount.isDefined && loginAccount.get.userName == account.userName){
|
||||
<li class="pull-right">
|
||||
<div class="button-group">
|
||||
|
||||
@@ -13,6 +13,13 @@
|
||||
<li@if(active=="application"){ class="active"}>
|
||||
<a href="@path/@loginAccount.get.userName/_application">Applications</a>
|
||||
</li>
|
||||
@gitbucket.core.plugin.PluginRegistry().getAccountSettingMenus.map { menu =>
|
||||
@menu(context).map { link =>
|
||||
<li@if(active==link.id){ class="active"}>
|
||||
<a href="@path/@link.path">@link.label</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-content">
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
<li>
|
||||
<a href="@path/console/login.jsp">H2 Console</a>
|
||||
</li>
|
||||
@gitbucket.core.plugin.PluginRegistry().getSystemSettingMenus.map { menu =>
|
||||
@menu(context).map { link =>
|
||||
<li@if(active==link.id){ class="active"}>
|
||||
<a href="@path/@link.path">@link.label</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-content">
|
||||
|
||||
@@ -11,12 +11,10 @@
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main("Issues"){
|
||||
@sidebar(recentRepositories, userRepositories){
|
||||
<div style="overflow: hidden;">
|
||||
@dashboard.html.tab("issues")
|
||||
<div class="container">
|
||||
@issuesnavi(filter, openCount, closedCount, condition)
|
||||
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
|
||||
</div>
|
||||
@dashboard.html.tab("issues")
|
||||
<div class="container">
|
||||
@issuesnavi(filter, openCount, closedCount, condition)
|
||||
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,10 @@
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main("Pull Requests"){
|
||||
@sidebar(recentRepositories, userRepositories){
|
||||
<div style="overflow: hidden;">
|
||||
@dashboard.html.tab("pulls")
|
||||
<div class="container">
|
||||
@issuesnavi(filter, openCount, closedCount, condition)
|
||||
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
|
||||
</div>
|
||||
@dashboard.html.tab("pulls")
|
||||
<div class="container">
|
||||
@issuesnavi(filter, openCount, closedCount, condition)
|
||||
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,10 @@
|
||||
@if(loginAccount.isDefined){
|
||||
<li @if(active == "pulls" ){ class="active"}><a href="@path/dashboard/pulls">Pull Requests</a></li>
|
||||
<li @if(active == "issues"){ class="active"}><a href="@path/dashboard/issues">Issues</a></li>
|
||||
@gitbucket.core.plugin.PluginRegistry().getDashboardTabs.map { tab =>
|
||||
@tab(context).map { link =>
|
||||
<li @if(active == link.id){ class="active"}><a href="@path/@link.path">@link.label</a></li>
|
||||
}
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
@Html(information)
|
||||
</div>
|
||||
}
|
||||
<div style="overflow: hidden;">
|
||||
@dashboard.html.tab()
|
||||
<div class="container">
|
||||
<div class="pull-right">
|
||||
<a href="@path/activities.atom"><img src="@assets/common/images/feed.png" alt="activities"></a>
|
||||
</div>
|
||||
@helper.html.activities(activities)
|
||||
@dashboard.html.tab()
|
||||
<div class="container">
|
||||
<div class="pull-right">
|
||||
<a href="@path/activities.atom"><img src="@assets/common/images/feed.png" alt="activities"></a>
|
||||
</div>
|
||||
@helper.html.activities(activities)
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
@html.main(s"New Issue - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@html.menu("issues", repository){
|
||||
<form action="@url(repository)/issues/new" method="POST" validate="true" class="form-group">
|
||||
<div class="row">
|
||||
<div class="row-fluid">
|
||||
<div class="col-md-9">
|
||||
<span id="error-title" class="error"></span>
|
||||
<input type="text" id="issue-title" name="title" class="form-control" value="" placeholder="Title" style="margin-bottom: 6px;" autofocus/>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row" style="margin-top: 15px;">
|
||||
<div class="row-fluid" style="margin-top: 15px;">
|
||||
<div class="col-md-9">
|
||||
@commentlist(Some(issue), comments, hasWritePermission, repository)
|
||||
@commentform(issue, true, hasWritePermission, repository)
|
||||
|
||||
@@ -71,6 +71,11 @@
|
||||
<input type="hidden" name="repository" value="@repository.name"/>
|
||||
}
|
||||
}
|
||||
@gitbucket.core.plugin.PluginRegistry().getGlobalMenus.map { menu =>
|
||||
@menu(context).map { link =>
|
||||
<a href="@path/@link.path" class="global-header-menu">@link.label</a>
|
||||
}
|
||||
}
|
||||
@if(loginAccount.isDefined){
|
||||
<div class="pull-right" style="margin-top: 6px;">
|
||||
<div class="btn-group" style="margin-right: 8px;">
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
|
||||
@menuitem(path: String, name: String, label: String, count: Int = 0) = {
|
||||
@menuitem(path: String, name: String, label: String, icon: String, count: Int = 0) = {
|
||||
<li @if(active == name){class="active"}>
|
||||
<a href="@url(repository)@path">
|
||||
@label
|
||||
@if(count > 0){
|
||||
<span class="badge">@count</span>
|
||||
}
|
||||
<i class="menu-icon octicon octicon-@icon"></i>
|
||||
<span class="pc">
|
||||
@label
|
||||
@if(count > 0){
|
||||
<span class="badge">@count</span>
|
||||
}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@@ -41,19 +44,24 @@
|
||||
<div class="container body">
|
||||
<div class="main-sidebar">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
@menuitem("" ,"files" ,"Files")
|
||||
@menuitem("" ,"files" ,"Files", "code")
|
||||
@if(repository.commitCount != 0) {
|
||||
@menuitem("/branches" ,"branches" ,"Branches", repository.branchList.length)
|
||||
@menuitem("/tags" ,"tags" ,"Tags", repository.tags.length)
|
||||
@menuitem("/branches" ,"branches" ,"Branches", "git-branch", repository.branchList.length)
|
||||
@menuitem("/tags" ,"tags" ,"Tags", "tag", repository.tags.length)
|
||||
}
|
||||
@menuitem("/issues" ,"issues" ,"Issues", repository.issueCount)
|
||||
@menuitem("/pulls" ,"pulls" ,"Pull Requests", repository.pullCount)
|
||||
@menuitem("/issues/labels" ,"labels" ,"Labels")
|
||||
@menuitem("/issues/milestones" ,"milestones" ,"Milestones")
|
||||
@menuitem("/wiki" ,"wiki" ,"Wiki")
|
||||
@menuitem("/network/members", "fork", "Forks", repository.forkedCount)
|
||||
@menuitem("/issues" ,"issues" ,"Issues", "issue-opened", repository.issueCount)
|
||||
@menuitem("/pulls" ,"pulls" ,"Pull Requests", "git-pull-request", repository.pullCount)
|
||||
@menuitem("/issues/labels" ,"labels" ,"Labels", "tag")
|
||||
@menuitem("/issues/milestones" ,"milestones" ,"Milestones", "milestone")
|
||||
@menuitem("/wiki" ,"wiki" ,"Wiki", "book")
|
||||
@menuitem("/network/members", "fork", "Forks", "repo-forked", repository.forkedCount)
|
||||
@if(loginAccount.isDefined && (loginAccount.get.isAdmin || repository.managers.contains(loginAccount.get.userName))){
|
||||
@menuitem("/settings" , "settings" , "Settings")
|
||||
@menuitem("/settings" , "settings" , "Settings", "tools")
|
||||
}
|
||||
@gitbucket.core.plugin.PluginRegistry().getRepositoryMenus.map { menu =>
|
||||
@menu(repository, context).map { link =>
|
||||
@menuitem(link.path, link.id, link.label, link.icon.getOrElse("ruby"))
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@(files: List[gitbucket.core.service.RepositorySearchService.FileSearchResult],
|
||||
issueCount: Int,
|
||||
wikiCount: Int,
|
||||
query: String,
|
||||
page: Int,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@@ -7,7 +8,7 @@
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import gitbucket.core.service.RepositorySearchService._
|
||||
@html.main("Search Results", Some(repository)){
|
||||
@menu("code", files.size, issueCount, query, repository){
|
||||
@menu("code", files.size, issueCount, wikiCount, query, repository){
|
||||
@if(files.isEmpty){
|
||||
<h4>We couldn't find any code matching '@query'</h4>
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@(issues: List[gitbucket.core.service.RepositorySearchService.IssueSearchResult],
|
||||
fileCount: Int,
|
||||
@(fileCount: Int,
|
||||
issues: List[gitbucket.core.service.RepositorySearchService.IssueSearchResult],
|
||||
wikiCount: Int,
|
||||
query: String,
|
||||
page: Int,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@@ -7,7 +8,7 @@
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import gitbucket.core.service.RepositorySearchService._
|
||||
@html.main("Search Results", Some(repository)){
|
||||
@menu("issue", fileCount, issues.size, query, repository){
|
||||
@menu("issue", fileCount, issues.size, wikiCount, query, repository){
|
||||
@if(issues.isEmpty){
|
||||
<h4>We couldn't find any code matching '@query'</h4>
|
||||
} else {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
@(active: String, fileCount: Int, issueCount: Int, query: String,
|
||||
@(active: String, fileCount: Int, issueCount: Int, wikiCount: Int, query: String,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(body: Html)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.menu("", repository){
|
||||
<div style="overflow: hidden;">
|
||||
<ul class="nav nav-tabs" style="margin-bottom: 20px;">
|
||||
<li@if(active=="code"){ class="active"}>
|
||||
<a href="@url(repository)/search?q=@urlEncode(query)&type=code">
|
||||
@@ -21,6 +20,14 @@
|
||||
}
|
||||
</a>
|
||||
</li>
|
||||
<li@if(active=="wiki"){ class="active"}>
|
||||
<a href="@url(repository)/search?q=@urlEncode(query)&type=wiki">
|
||||
Wiki
|
||||
@if(wikiCount != 0){
|
||||
<span class="badge">@wikiCount</span>
|
||||
}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="@url(repository)/search" method="GET" class="form-inline">
|
||||
<input type="text" name="q" value="@query" class="form-control" style="width: 400px; margin-bottom: 0px;"/>
|
||||
@@ -28,5 +35,4 @@
|
||||
<input type="hidden" name="type" value="@active"/>
|
||||
</form>
|
||||
@body
|
||||
</div>
|
||||
}
|
||||
27
src/main/twirl/gitbucket/core/search/wiki.scala.html
Normal file
27
src/main/twirl/gitbucket/core/search/wiki.scala.html
Normal file
@@ -0,0 +1,27 @@
|
||||
@(fileCount: Int,
|
||||
issueCount: Int,
|
||||
wikis: List[gitbucket.core.service.RepositorySearchService.FileSearchResult],
|
||||
query: String,
|
||||
page: Int,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import gitbucket.core.service.RepositorySearchService._
|
||||
@html.main("Search Results", Some(repository)){
|
||||
@menu("wiki", fileCount, issueCount, wikis.size, query, repository){
|
||||
@if(wikis.isEmpty){
|
||||
<h4>We couldn't find any code matching '@query'</h4>
|
||||
} else {
|
||||
<h4>We've found @wikis.size code @plural(wikis.size, "result")</h4>
|
||||
}
|
||||
@wikis.drop((page - 1) * CodeLimit).take(CodeLimit).map { file =>
|
||||
<div>
|
||||
<h5><a href="@url(repository)/wiki/@file.path">@file.path</a></h5>
|
||||
<div class="small muted">Last committed @helper.html.datetimeago(file.lastModified)</div>
|
||||
<pre class="prettyprint linenums:@file.highlightLineNumber" style="padding-left: 25px;">@Html(file.highlightText)</pre>
|
||||
</div>
|
||||
}
|
||||
@helper.html.paginator(page, wikis.size, CodeLimit, 10,
|
||||
s"${url(repository)}/search?q=${urlEncode(query)}&type=code")
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ function submitForm(e){
|
||||
var protection = getValue();
|
||||
$.ajax({
|
||||
method:'PATCH',
|
||||
url:'/api/v3/repos/@repository.owner/@repository.name/branches/@encodeRefName(branch)',
|
||||
url:'@path/api/v3/repos/@repository.owner/@repository.name/branches/@encodeRefName(branch)',
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
data:JSON.stringify({protection:protection}),
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import gitbucket.core.model.WebHook._
|
||||
@import gitbucket.core.model.WebHookContentType
|
||||
@check(name: String, event: Event)={
|
||||
name="@(name).@event.name" value="on" @if(events(event)){checked}
|
||||
}
|
||||
@@ -30,6 +31,14 @@
|
||||
}
|
||||
<button class="btn btn-default" id="test">Test Hook</button>
|
||||
</fieldset>
|
||||
<fieldset class="form-group">
|
||||
<label class="strong">Content type</label>
|
||||
<div></div>
|
||||
<select name="ctype">
|
||||
<option value="@WebHookContentType.FORM.code" @if(webHook.ctype == WebHookContentType.FORM){selected}>@WebHookContentType.FORM.ctype</option>
|
||||
<option value="@WebHookContentType.JSON.code" @if(webHook.ctype == WebHookContentType.JSON){selected}>@WebHookContentType.JSON.ctype</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<fieldset class="form-group">
|
||||
<label class="strong">Security Token</label>
|
||||
<div></div>
|
||||
@@ -129,6 +138,7 @@ $(function(){
|
||||
e.preventDefault();
|
||||
var url = this.form.url.value;
|
||||
var token = this.form.token.value;
|
||||
var ctype = this.form.ctype.value;
|
||||
if(!/^https?:\/\/.+/.test(url)){
|
||||
alert("invalid url");
|
||||
return;
|
||||
@@ -136,9 +146,13 @@ $(function(){
|
||||
$("#test-modal-url").text(url)
|
||||
$("#test-report-modal").modal('show')
|
||||
$("#test-report").hide();
|
||||
var targetUrl = '@url(repository)/settings/hooks/test?url=' + encodeURIComponent(url) + '&token=';
|
||||
if (token) {
|
||||
targetUrl = targetUrl + encodeURIComponent(token);
|
||||
}
|
||||
$.ajax({
|
||||
method:'POST',
|
||||
url:'@url(repository)/settings/hooks/test?url=' + encodeURIComponent(url) + '&token=' + encodeURIComponent(token),
|
||||
url:targetUrl,
|
||||
success: function(e){
|
||||
//console.log(e);
|
||||
$('#test-report-tab a:first').tab('show');
|
||||
|
||||
@@ -1,25 +1,30 @@
|
||||
@(active: String, repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(body: Html)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
<div style="overflow: hidden;">
|
||||
<ul class="nav nav-tabs" style="margin-bottom: 20px;">
|
||||
<li@if(active=="options"){ class="active"}>
|
||||
<a href="@url(repository)/settings/options">Options</a>
|
||||
</li>
|
||||
<li@if(active=="collaborators"){ class="active"}>
|
||||
<a href="@url(repository)/settings/collaborators">Collaborators</a>
|
||||
</li>
|
||||
@if(!repository.branchList.isEmpty){
|
||||
<li@if(active=="branches"){ class="active"}>
|
||||
<a href="@url(repository)/settings/branches">Branches</a>
|
||||
</li>
|
||||
<ul class="nav nav-tabs" style="margin-bottom: 20px;">
|
||||
<li@if(active=="options"){ class="active"}>
|
||||
<a href="@url(repository)/settings/options">Options</a>
|
||||
</li>
|
||||
<li@if(active=="collaborators"){ class="active"}>
|
||||
<a href="@url(repository)/settings/collaborators">Collaborators</a>
|
||||
</li>
|
||||
@if(!repository.branchList.isEmpty){
|
||||
<li@if(active=="branches"){ class="active"}>
|
||||
<a href="@url(repository)/settings/branches">Branches</a>
|
||||
</li>
|
||||
}
|
||||
<li@if(active=="hooks"){ class="active"}>
|
||||
<a href="@url(repository)/settings/hooks">Service Hooks</a>
|
||||
</li>
|
||||
<li@if(active=="danger"){ class="active"}>
|
||||
<a href="@url(repository)/settings/danger">Danger Zone</a>
|
||||
</li>
|
||||
@gitbucket.core.plugin.PluginRegistry().getRepositorySettingTabs.map { tab =>
|
||||
@tab(repository, context).map { link =>
|
||||
<li@if(active==link.id){ class="active"}>
|
||||
<a href="@url(repository)/@link.path">@link.label</a>
|
||||
</li>
|
||||
}
|
||||
<li@if(active=="hooks"){ class="active"}>
|
||||
<a href="@url(repository)/settings/hooks">Service Hooks</a>
|
||||
</li>
|
||||
<li@if(active=="danger"){ class="active"}>
|
||||
<a href="@url(repository)/settings/danger">Danger Zone</a>
|
||||
</li>
|
||||
</ul>
|
||||
@body
|
||||
</div>
|
||||
}
|
||||
</ul>
|
||||
@body
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@(pageName: String,
|
||||
page: Option[gitbucket.core.service.WikiService.WikiPageInfo],
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import context._
|
||||
@import gitbucket.core.view.helpers._
|
||||
@import gitbucket.core.util.FileUtil
|
||||
@html.main(s"${if(pageName.isEmpty) "New Page" else pageName} - ${repository.owner}/${repository.name}", Some(repository)){
|
||||
@html.menu("wiki", repository){
|
||||
<div class="pull-right">
|
||||
@@ -12,11 +12,11 @@
|
||||
}
|
||||
<a class="btn btn-small btn-success" href="@url(repository)/wiki/_new">New Page</a>
|
||||
</div>
|
||||
<h1><span class="muted">Editing</span> @if(pageName.isEmpty){New Page} else {@pageName}</h1>
|
||||
<div style="overflow: hidden;">
|
||||
<form action="@url(repository)/wiki/@if(page.isEmpty){_new} else {_edit}" method="POST" validate="true">
|
||||
<span id="error-pageName" class="error"></span>
|
||||
<input type="text" name="pageName" value="@pageName" class="form-control" style="font-weight: bold; margin-bottom: 10px;" placeholder="Input a page name."/>
|
||||
<h1 class="wiki-title"><span class="muted">Editing</span> @if(pageName.isEmpty){New Page} else {@pageName}</h1>
|
||||
<form action="@url(repository)/wiki/@if(page.isEmpty){_new} else {_edit}" method="POST" validate="true">
|
||||
<span id="error-pageName" class="error"></span>
|
||||
<input type="text" name="pageName" value="@pageName" class="form-control" style="font-weight: bold; margin-bottom: 10px;" placeholder="Input a page name."/>
|
||||
<div class="muted attachable">
|
||||
@helper.html.preview(
|
||||
repository = repository,
|
||||
content = page.map(_.content).getOrElse(""),
|
||||
@@ -27,23 +27,44 @@
|
||||
hasWritePermission = false,
|
||||
style = "height: 400px;",
|
||||
styleClass = "monospace",
|
||||
placeholder = ""
|
||||
placeholder = "",
|
||||
uid = 1
|
||||
)
|
||||
<div class="form-group">
|
||||
<label for="message">Edit Message</label>
|
||||
<input type="text" id="message" name="message" value="" class="form-control" placeholder="Write a small message here explaining this change. (Optional)"/>
|
||||
</div>
|
||||
<div class="form-group pull-right">
|
||||
<input type="hidden" name="currentPageName" value="@pageName"/>
|
||||
<input type="hidden" name="id" value="@page.map(_.id)"/>
|
||||
<input type="submit" value="Save" class="btn btn-success">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="clickable">Attach images or documents by dragging & dropping, or selecting them.</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message">Edit Message</label>
|
||||
<input type="text" id="message" name="message" value="" class="form-control" placeholder="Write a small message here explaining this change. (Optional)"/>
|
||||
</div>
|
||||
<div class="form-group pull-right">
|
||||
<input type="hidden" name="currentPageName" value="@pageName"/>
|
||||
<input type="hidden" name="id" value="@page.map(_.id)"/>
|
||||
<input type="submit" value="Save" class="btn btn-success">
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
<script>
|
||||
$(function(){
|
||||
try {
|
||||
$('.clickable').dropzone({
|
||||
url: '@context.path/upload/wiki/@repository.owner/@repository.name',
|
||||
maxFilesize: 10,
|
||||
acceptedFiles: @Html(FileUtil.mimeTypeWhiteList.mkString("'", ",", "'")),
|
||||
dictInvalidFileType: 'Unfortunately, we don\'t support that file type. Try again with a PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, or PDF.',
|
||||
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
|
||||
success: function(file, id) {
|
||||
var attachFile = (file.type.match(/image\/.*/) ? '\n![' + file.name.split('.')[0] : '\n[' + file.name) + '](' + file.name + ')';
|
||||
$('#content1').val($('#content1').val() + attachFile);
|
||||
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
if (e.message !== "Dropzone already attached.") {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
$('#delete').click(function(){
|
||||
return confirm('Are you sure you want to delete this page?');
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<span class="muted">History for</span> @pageName.get
|
||||
}
|
||||
</h1>
|
||||
<table class="table table-bordered fill-width pull-left">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">
|
||||
@@ -38,9 +38,9 @@
|
||||
<tbody>
|
||||
@commits.map { commit =>
|
||||
<tr>
|
||||
<td width="0%"><input type="checkbox" name="commitId" value="@commit.id"></td>
|
||||
<td>@avatar(commit, 20) @user(commit.authorName, commit.authorEmailAddress)</td>
|
||||
<td width="80%">
|
||||
<td style="width: 32px; text-align: center ;"><input type="checkbox" name="commitId" value="@commit.id"></td>
|
||||
<td style="width: 200px;">@avatar(commit, 20) @user(commit.authorName, commit.authorEmailAddress)</td>
|
||||
<td>
|
||||
<span class="muted">@helper.html.datetimeago(commit.authorTime):</span> @commit.shortMessage
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -106,8 +106,8 @@
|
||||
<script>
|
||||
$(function(){
|
||||
$('#show-more-pages').click(function(e){
|
||||
$('div.page-link').show();
|
||||
$(e.target).parents('div.show-more').remove();
|
||||
$('li.page-link').show();
|
||||
$(e.target).parents('li.show-more').remove();
|
||||
});
|
||||
|
||||
$('#show-pages-index').click(function(e){
|
||||
|
||||
@@ -201,6 +201,7 @@ div.main-sidebar {
|
||||
|
||||
div.main-content {
|
||||
margin-left: 260px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.main-center {
|
||||
@@ -215,6 +216,7 @@ div.dashboard-sidebar {
|
||||
|
||||
div.dashboard-content {
|
||||
margin-left: 310px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.body {
|
||||
@@ -1204,7 +1206,8 @@ table.diff td.body{
|
||||
}
|
||||
|
||||
table.diff th.line-num{
|
||||
min-width: 20px;
|
||||
/*min-width: 20px;*/
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
table.diff .add-comment {
|
||||
@@ -1863,19 +1866,29 @@ div.container.blame-container{
|
||||
input[name=query] {
|
||||
display: none;
|
||||
}
|
||||
#dashboard-signin-form {
|
||||
display: none;
|
||||
}
|
||||
.container {
|
||||
width: auto !important;
|
||||
}
|
||||
.body>div.pull-left {
|
||||
width: auto !important;
|
||||
}
|
||||
.pc {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.dashboard-sidebar {
|
||||
display: none;;
|
||||
}
|
||||
div.dashboard-content {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
div.main-sidebar {
|
||||
width: 40px;
|
||||
float: left;
|
||||
}
|
||||
div.main-content {
|
||||
margin-left: 42px;
|
||||
}
|
||||
|
||||
|
||||
/* Adjust issue / comment form */
|
||||
#issue-title {
|
||||
width: 100% !important;
|
||||
@@ -1903,17 +1916,8 @@ div.container.blame-container{
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
/*
|
||||
.nav-tabs a.btn[href$="/_edit"] {
|
||||
width: 24px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
padding: 4px 6px;
|
||||
margin: 3px 4px 0 0;
|
||||
}
|
||||
*/
|
||||
body>div.container.body {
|
||||
margin: 0 -12px 40px -12px;
|
||||
margin: 0 0 40px -12px;
|
||||
}
|
||||
/* Adjust sidemenu */
|
||||
.container.body>div[style="width: 170px;"]{
|
||||
|
||||
@@ -2,6 +2,7 @@ package gitbucket.core.service
|
||||
|
||||
import gitbucket.core.model.WebHook
|
||||
import org.scalatest.FunSuite
|
||||
import gitbucket.core.model.WebHookContentType
|
||||
|
||||
|
||||
class WebHookServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
@@ -16,12 +17,12 @@ class WebHookServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
val (issue3, pullreq3) = generateNewPullRequest("user3/repo3/master3", "user2/repo2/master2", loginUser="root")
|
||||
val (issue32, pullreq32) = generateNewPullRequest("user3/repo3/master32", "user2/repo2/master2", loginUser="root")
|
||||
generateNewPullRequest("user2/repo2/master2", "user1/repo1/master2")
|
||||
service.addWebHook("user1", "repo1", "webhook1-1", Set(WebHook.PullRequest), Some("key"))
|
||||
service.addWebHook("user1", "repo1", "webhook1-2", Set(WebHook.PullRequest), Some("key"))
|
||||
service.addWebHook("user2", "repo2", "webhook2-1", Set(WebHook.PullRequest), Some("key"))
|
||||
service.addWebHook("user2", "repo2", "webhook2-2", Set(WebHook.PullRequest), Some("key"))
|
||||
service.addWebHook("user3", "repo3", "webhook3-1", Set(WebHook.PullRequest), Some("key"))
|
||||
service.addWebHook("user3", "repo3", "webhook3-2", Set(WebHook.PullRequest), Some("key"))
|
||||
service.addWebHook("user1", "repo1", "webhook1-1", Set(WebHook.PullRequest), WebHookContentType.FORM, Some("key"))
|
||||
service.addWebHook("user1", "repo1", "webhook1-2", Set(WebHook.PullRequest), WebHookContentType.FORM, Some("key"))
|
||||
service.addWebHook("user2", "repo2", "webhook2-1", Set(WebHook.PullRequest), WebHookContentType.FORM, Some("key"))
|
||||
service.addWebHook("user2", "repo2", "webhook2-2", Set(WebHook.PullRequest), WebHookContentType.FORM, Some("key"))
|
||||
service.addWebHook("user3", "repo3", "webhook3-1", Set(WebHook.PullRequest), WebHookContentType.FORM, Some("key"))
|
||||
service.addWebHook("user3", "repo3", "webhook3-2", Set(WebHook.PullRequest), WebHookContentType.FORM, Some("key"))
|
||||
|
||||
assert(service.getPullRequestsByRequestForWebhook("user1","repo1","master1") == Map.empty)
|
||||
|
||||
@@ -43,33 +44,36 @@ class WebHookServiceSpec extends FunSuite with ServiceSpecBase {
|
||||
|
||||
test("add and get and update and delete") { withTestDB { implicit session =>
|
||||
val user1 = generateNewUserWithDBRepository("user1","repo1")
|
||||
service.addWebHook("user1", "repo1", "http://example.com", Set(WebHook.PullRequest), Some("key"))
|
||||
assert(service.getWebHooks("user1", "repo1") == List((WebHook("user1","repo1","http://example.com", Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((WebHook("user1","repo1","http://example.com", Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == List((WebHook("user1","repo1","http://example.com", Some("key")))))
|
||||
val formType = WebHookContentType.FORM
|
||||
val jsonType = WebHookContentType.JSON
|
||||
service.addWebHook("user1", "repo1", "http://example.com", Set(WebHook.PullRequest), formType, Some("key"))
|
||||
assert(service.getWebHooks("user1", "repo1") == List((WebHook("user1","repo1","http://example.com", formType, Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((WebHook("user1","repo1","http://example.com", formType, Some("key")),Set(WebHook.PullRequest))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == List((WebHook("user1","repo1","http://example.com", formType, Some("key")))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.Push) == Nil)
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com2") == None)
|
||||
assert(service.getWebHook("user2", "repo1", "http://example.com") == None)
|
||||
assert(service.getWebHook("user1", "repo2", "http://example.com") == None)
|
||||
service.updateWebHook("user1", "repo1", "http://example.com", Set(WebHook.Push, WebHook.Issues), Some("key"))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((WebHook("user1","repo1","http://example.com", Some("key")),Set(WebHook.Push, WebHook.Issues))))
|
||||
service.updateWebHook("user1", "repo1", "http://example.com", Set(WebHook.Push, WebHook.Issues), jsonType, Some("key"))
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == Some((WebHook("user1","repo1","http://example.com", jsonType, Some("key")),Set(WebHook.Push, WebHook.Issues))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == Nil)
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.Push) == List((WebHook("user1","repo1","http://example.com", Some("key")))))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.Push) == List((WebHook("user1","repo1","http://example.com", jsonType, Some("key")))))
|
||||
service.deleteWebHook("user1", "repo1", "http://example.com")
|
||||
assert(service.getWebHook("user1", "repo1", "http://example.com") == None)
|
||||
} }
|
||||
|
||||
test("getWebHooks, getWebHooksByEvent") { withTestDB { implicit session =>
|
||||
val user1 = generateNewUserWithDBRepository("user1","repo1")
|
||||
service.addWebHook("user1", "repo1", "http://example.com/1", Set(WebHook.PullRequest), Some("key"))
|
||||
service.addWebHook("user1", "repo1", "http://example.com/2", Set(WebHook.Push), Some("key"))
|
||||
service.addWebHook("user1", "repo1", "http://example.com/3", Set(WebHook.PullRequest,WebHook.Push), Some("key"))
|
||||
val ctype = WebHookContentType.FORM
|
||||
service.addWebHook("user1", "repo1", "http://example.com/1", Set(WebHook.PullRequest), ctype, Some("key"))
|
||||
service.addWebHook("user1", "repo1", "http://example.com/2", Set(WebHook.Push), ctype, Some("key"))
|
||||
service.addWebHook("user1", "repo1", "http://example.com/3", Set(WebHook.PullRequest,WebHook.Push), ctype, Some("key"))
|
||||
assert(service.getWebHooks("user1", "repo1") == List(
|
||||
WebHook("user1","repo1","http://example.com/1", Some("key"))->Set(WebHook.PullRequest),
|
||||
WebHook("user1","repo1","http://example.com/2", Some("key"))->Set(WebHook.Push),
|
||||
WebHook("user1","repo1","http://example.com/3", Some("key"))->Set(WebHook.PullRequest,WebHook.Push)))
|
||||
WebHook("user1","repo1","http://example.com/1", ctype, Some("key"))->Set(WebHook.PullRequest),
|
||||
WebHook("user1","repo1","http://example.com/2", ctype, Some("key"))->Set(WebHook.Push),
|
||||
WebHook("user1","repo1","http://example.com/3", ctype, Some("key"))->Set(WebHook.PullRequest,WebHook.Push)))
|
||||
assert(service.getWebHooksByEvent("user1", "repo1", WebHook.PullRequest) == List(
|
||||
WebHook("user1","repo1","http://example.com/1", Some("key")),
|
||||
WebHook("user1","repo1","http://example.com/3", Some("key"))))
|
||||
WebHook("user1","repo1","http://example.com/1", ctype, Some("key")),
|
||||
WebHook("user1","repo1","http://example.com/3", ctype, Some("key"))))
|
||||
} }
|
||||
}
|
||||
Reference in New Issue
Block a user