Merge branch 'master' into http-proxy-setting

This commit is contained in:
Naoki Takezoe
2018-07-29 12:58:41 +09:00
26 changed files with 230 additions and 71 deletions

View File

@@ -1,6 +1,12 @@
# Changelog
All changes to the project will be documented in this file.
### 4.27.0 - 29 Jul 2018
- Create new tag on the browser
- EditorConfig support
- Improve issues / pull requests search
- Some improvements and bug fixes for plugin installation via internet and pull request commenting
### 4.26.0 - 30 Jun 2018
- Installing plugins from the central registry
- Repositories tab in the dashboard

View File

@@ -68,14 +68,12 @@ Support
- If you can't find same question and report, send it to [gitter room](https://gitter.im/gitbucket/gitbucket) before raising an issue.
- The highest priority of GitBucket is the ease of installation and API compatibility with GitHub, so your feature request might be rejected if they go against those principles.
What's New in 4.26.x
What's New in 4.27.x
-------------
### 4.26.0 - 30 Jun 2018
- Installing plugins from the central registry
- Repositories tab in the dashboard
- Fork dialog enhancement
- Adjust pull request creation suggestor
- Keep showing incompleted task list
- New notification hooks
### 4.27.0 - 29 Jul 2018
- Create new tag on the browser
- EditorConfig support
- Improve issues / pull requests search
- Some improvements and bug fixes for plugin installation via internet and pull request commenting
See the [change log](CHANGELOG.md) for all of the updates.

View File

@@ -3,7 +3,7 @@ import com.typesafe.sbt.pgp.PgpKeys._
val Organization = "io.github.gitbucket"
val Name = "gitbucket"
val GitBucketVersion = "4.26.0"
val GitBucketVersion = "4.27.0"
val ScalatraVersion = "2.6.1"
val JettyVersion = "9.4.7.v20170914"
@@ -47,8 +47,8 @@ libraryDependencies ++= Seq(
"com.github.takezoe" %% "blocking-slick-32" % "0.0.10",
"com.novell.ldap" % "jldap" % "2009-10-07",
"com.h2database" % "h2" % "1.4.196",
"org.mariadb.jdbc" % "mariadb-java-client" % "2.2.5",
"org.postgresql" % "postgresql" % "42.1.4",
"org.mariadb.jdbc" % "mariadb-java-client" % "2.2.6",
"org.postgresql" % "postgresql" % "42.2.4",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.zaxxer" % "HikariCP" % "2.7.4",
"com.typesafe" % "config" % "1.3.2",

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<changeSet>
<addColumn tableName="COMMIT_COMMENT">
<column name="ORIGINAL_COMMIT_ID" type="varchar(100)" nullable="true"/>
<column name="ORIGINAL_OLD_LINE" type="int" nullable="true"/>
<column name="ORIGINAL_NEW_LINE" type="int" nullable="true"/>
</addColumn>
<update tableName="COMMIT_COMMENT">
<column name="ORIGINAL_COMMIT_ID" valueComputed="COMMIT_ID"/>
<column name="ORIGINAL_OLD_LINE" valueComputed="OLD_LINE_NUMBER"/>
<column name="ORIGINAL_NEW_LINE" valueComputed="NEW_LINE_NUMBER"/>
</update>
<addNotNullConstraint columnName="ORIGINAL_COMMIT_ID" tableName="COMMIT_COMMENT" columnDataType="varchar(100)"/>
</changeSet>

View File

@@ -55,5 +55,6 @@ object GitBucketCoreModule
new Version("4.24.0", new LiquibaseMigration("update/gitbucket-core_4.24.xml")),
new Version("4.24.1"),
new Version("4.25.0", new LiquibaseMigration("update/gitbucket-core_4.25.xml")),
new Version("4.26.0")
new Version("4.26.0"),
new Version("4.27.0", new LiquibaseMigration("update/gitbucket-core_4.27.xml"))
)

View File

@@ -237,9 +237,19 @@ trait IndexControllerBase extends ControllerBase {
}
target.toLowerCase match {
case "issue" =>
case "issues" =>
gitbucket.core.search.html.issues(
if (query.nonEmpty) searchIssues(repository.owner, repository.name, query) else Nil,
if (query.nonEmpty) searchIssues(repository.owner, repository.name, query, false) else Nil,
false,
query,
page,
repository
)
case "pulls" =>
gitbucket.core.search.html.issues(
if (query.nonEmpty) searchIssues(repository.owner, repository.name, query, true) else Nil,
true,
query,
page,
repository

View File

@@ -117,6 +117,12 @@ trait RepositoryViewerControllerBase extends ControllerBase {
diff: Option[String]
)
case class TagForm(
commitId: String,
tagName: String,
message: Option[String]
)
val uploadForm = mapping(
"branch" -> trim(label("Branch", text(required))),
"path" -> trim(label("Path", text())),
@@ -153,6 +159,12 @@ trait RepositoryViewerControllerBase extends ControllerBase {
"diff" -> optional(text())
)(CommentForm.apply)
val tagForm = mapping(
"commitId" -> trim(label("Commit id", text(required))),
"tagName" -> trim(label("Tag name", text(required))),
"message" -> trim(label("Message", optional(text())))
)(TagForm.apply)
/**
* Returns converted HTML from Markdown for preview.
*/
@@ -427,8 +439,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
commit = form.commit
)
println(form.path)
redirect(
s"/${repository.owner}/${repository.name}/tree/${form.branch}${if (form.path.length == 0) "" else form.path}"
s"/${repository.owner}/${repository.name}/tree/${form.branch}${if (form.path.length == 0) "" else "/" + form.path}"
)
})
@@ -540,7 +554,9 @@ trait RepositoryViewerControllerBase extends ControllerBase {
repository,
diffs,
oldCommitId,
hasDeveloperRole(repository.owner, repository.name, context.loginAccount)
hasDeveloperRole(repository.owner, repository.name, context.loginAccount),
flash.get("info"),
flash.get("error")
)
}
}
@@ -789,6 +805,29 @@ trait RepositoryViewerControllerBase extends ControllerBase {
html.branches(branches, hasDeveloperRole(repository.owner, repository.name, context.loginAccount), repository)
})
/**
* Displays the create tag dialog.
*/
get("/:owner/:repository/tag/:id")(writableUsersOnly { repository =>
html.tag(params("id"), repository)
})
/**
* Creates a tag.
*/
post("/:owner/:repository/tag", tagForm)(writableUsersOnly { (form, repository) =>
using(Git.open(getRepositoryDir(repository.owner, repository.name))) { git =>
JGitUtil.createTag(git, form.tagName, form.message, form.commitId)
} match {
case Right(message) =>
flash += "info" -> message
redirect(s"/${repository.owner}/${repository.name}/commit/${form.commitId}")
case Left(message) =>
flash += "error" -> message
redirect(s"/${repository.owner}/${repository.name}/commit/${form.commitId}")
}
})
/**
* Creates a branch.
*/

View File

@@ -54,6 +54,9 @@ trait CommitCommentComponent extends TemplateComponent { self: Profile =>
val registeredDate = column[java.util.Date]("REGISTERED_DATE")
val updatedDate = column[java.util.Date]("UPDATED_DATE")
val issueId = column[Option[Int]]("ISSUE_ID")
val originalCommitId = column[String]("ORIGINAL_COMMIT_ID")
val originalOldLine = column[Option[Int]]("ORIGINAL_OLD_LINE")
val originalNewLine = column[Option[Int]]("ORIGINAL_NEW_LINE")
def * =
(
userName,
@@ -67,7 +70,10 @@ trait CommitCommentComponent extends TemplateComponent { self: Profile =>
newLine,
registeredDate,
updatedDate,
issueId
issueId,
originalCommitId,
originalOldLine,
originalNewLine
) <> (CommitComment.tupled, CommitComment.unapply)
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
@@ -86,7 +92,10 @@ case class CommitComment(
newLine: Option[Int],
registeredDate: java.util.Date,
updatedDate: java.util.Date,
issueId: Option[Int]
issueId: Option[Int],
originalCommitId: String,
originalOldLine: Option[Int],
originalNewLine: Option[Int]
) extends Comment
case class CommitComments(

View File

@@ -49,7 +49,10 @@ trait CommitsService {
newLine = newLine,
registeredDate = currentDate,
updatedDate = currentDate,
issueId = issueId
issueId = issueId,
originalCommitId = commitId,
originalOldLine = oldLine,
originalNewLine = newLine
)
def updateCommitCommentPosition(commentId: Int, commitId: String, oldLine: Option[Int], newLine: Option[Int])(

View File

@@ -630,7 +630,7 @@ trait IssuesService {
* @param query the keywords separated by whitespace.
* @return issues with comment count and matched content of issue or comment
*/
def searchIssuesByKeyword(owner: String, repository: String, query: String)(
def searchIssuesByKeyword(owner: String, repository: String, query: String, pullRequest: Boolean)(
implicit s: Session
): List[(Issue, Int, String)] = {
//import slick.driver.JdbcDriver.likeEncode
@@ -638,7 +638,9 @@ trait IssuesService {
// Search Issue
val issues = Issues
.filter(_.byRepository(owner, repository))
.filter { t =>
t.byRepository(owner, repository) && t.pullRequest === pullRequest.bind
}
.join(IssueOutline)
.on {
case (t1, t2) =>
@@ -673,11 +675,12 @@ trait IssuesService {
}
.filter {
case ((t1, t2), t3) =>
keywords
.map { query =>
t1.content.toLowerCase like (s"%${likeEncode(query)}%", '^')
}
.reduceLeft(_ && _)
t2.pullRequest === pullRequest.bind &&
keywords
.map { query =>
t1.content.toLowerCase like (s"%${likeEncode(query)}%", '^')
}
.reduceLeft(_ && _)
}
.map {
case ((t1, t2), t3) =>
@@ -688,7 +691,7 @@ trait IssuesService {
.union(comments)
.sortBy {
case (issue, commentId, _, _) =>
issue.issueId -> commentId
issue.issueId.desc -> commentId
}
.list
.splitWith {

View File

@@ -181,9 +181,9 @@ trait PullRequestService { self: IssuesService with CommitsService =>
// Collect comment positions
val positions = getCommitComments(pullreq.userName, pullreq.repositoryName, pullreq.commitIdTo, true)
.collect {
case CommitComment(_, _, _, commentId, _, _, Some(file), None, Some(newLine), _, _, _) =>
case CommitComment(_, _, _, commentId, _, _, Some(file), None, Some(newLine), _, _, _, _, _, _) =>
(file, commentId, Right(newLine))
case CommitComment(_, _, _, commentId, _, _, Some(file), Some(oldLine), None, _, _, _) =>
case CommitComment(_, _, _, commentId, _, _, Some(file), Some(oldLine), None, _, _, _, _, _, _) =>
(file, commentId, Left(oldLine))
}
.groupBy { case (file, _, _) => file }
@@ -348,7 +348,7 @@ trait PullRequestService { self: IssuesService with CommitsService =>
.groupBy {
case x: IssueComment => (Some(x.commentId), None, None, None)
case x: CommitComment if x.fileName.isEmpty => (Some(x.commentId), None, None, None)
case x: CommitComment => (None, x.fileName, x.oldLine, x.newLine)
case x: CommitComment => (None, x.fileName, x.originalOldLine, x.originalNewLine)
case x => throw new MatchError(x)
}
.toSeq
@@ -366,7 +366,7 @@ trait PullRequestService { self: IssuesService with CommitsService =>
diff = loadCommitCommentDiff(
userName,
repositoryName,
comments.head.asInstanceOf[CommitComment].commitId,
comments.head.asInstanceOf[CommitComment].originalCommitId,
fileName,
oldLine,
newLine

View File

@@ -14,18 +14,21 @@ import gitbucket.core.model.Profile.profile.blockingApi._
trait RepositorySearchService { self: IssuesService =>
import RepositorySearchService._
def countIssues(owner: String, repository: String, query: String)(implicit session: Session): Int =
searchIssuesByKeyword(owner, repository, query).length
def countIssues(owner: String, repository: String, query: String, pullRequest: Boolean)(
implicit session: Session
): Int =
searchIssuesByKeyword(owner, repository, query, pullRequest).length
def searchIssues(owner: String, repository: String, query: String)(
def searchIssues(owner: String, repository: String, query: String, pullRequest: Boolean)(
implicit session: Session
): List[IssueSearchResult] =
searchIssuesByKeyword(owner, repository, query).map {
searchIssuesByKeyword(owner, repository, query, pullRequest).map {
case (issue, commentCount, content) =>
IssueSearchResult(
issue.issueId,
issue.isPullRequest,
issue.title,
issue.closed,
issue.openedUserName,
issue.registeredDate,
commentCount,
@@ -142,6 +145,7 @@ object RepositorySearchService {
issueId: Int,
isPullRequest: Boolean,
title: String,
isClosed: Boolean,
openedUserName: String,
registeredDate: java.util.Date,
commentCount: Int,

View File

@@ -143,6 +143,7 @@ object JDBCUtil {
case Types.BOOLEAN | Types.BIT => rs.getBoolean(columnName)
case Types.VARCHAR | Types.CLOB | Types.CHAR | Types.LONGVARCHAR => rs.getString(columnName)
case Types.INTEGER => rs.getInt(columnName)
case Types.BIGINT => rs.getLong(columnName)
case Types.TIMESTAMP => rs.getTimestamp(columnName)
}
}
@@ -202,8 +203,7 @@ object JDBCUtil {
private def allTablesOrderByDependencies(meta: DatabaseMetaData): Seq[String] = {
val tables = allTableNames.map { tableName =>
val result = TableDependency(tableName, childTables(meta, tableName))
result
TableDependency(tableName, childTables(meta, tableName))
}
val edges = tables.flatMap { table =>
@@ -212,7 +212,10 @@ object JDBCUtil {
}
}
tsort(edges).toSeq
val ordered = tsort(edges).toSeq
val orphans = tables.collect { case x if !ordered.contains(x.tableName) => x.tableName }
ordered ++ orphans
}
def tsort[A](edges: Traversable[(A, A)]): Iterable[A] = {

View File

@@ -23,12 +23,7 @@ import java.util.concurrent.TimeUnit
import java.util.function.Consumer
import org.cache2k.Cache2kBuilder
import org.eclipse.jgit.api.errors.{
InvalidRefNameException,
JGitInternalException,
NoHeadException,
RefAlreadyExistsException
}
import org.eclipse.jgit.api.errors._
import org.eclipse.jgit.diff.{DiffEntry, DiffFormatter, RawTextComparator}
import org.eclipse.jgit.dircache.DirCacheEntry
import org.eclipse.jgit.util.io.DisabledOutputStream
@@ -836,6 +831,25 @@ object JGitUtil {
.find(_._1 != null)
}
def createTag(git: Git, name: String, message: Option[String], commitId: String) = {
try {
val objectId: ObjectId = git.getRepository.resolve(commitId)
using(new RevWalk(git.getRepository)) { walk =>
val tagCommand = git.tag().setName(name).setObjectId(walk.parseCommit(objectId))
message.foreach { message =>
tagCommand.setMessage(message)
}
tagCommand.call()
}
Right("Tag added.")
} catch {
case e: GitAPIException => Left("Sorry, some Git operation error occurs.")
case e: ConcurrentRefUpdateException => Left("Sorry some error occurs.")
case e: InvalidTagNameException => Left("Sorry, that name is invalid.")
case e: NoHeadException => Left("Sorry, this repo doesn't have HEAD reference")
}
}
def createBranch(git: Git, fromBranch: String, newBranch: String) = {
try {
git.branchCreate().setStartPoint(fromBranch).setName(newBranch).call()

View File

@@ -5,8 +5,11 @@ import SyntaxSugars._
import gitbucket.core.service.SystemSettingsService
import gitbucket.core.service.SystemSettingsService.Ldap
import com.novell.ldap._
import java.security.Security
import java.security.{Provider, Security}
import java.util.concurrent.atomic.AtomicReference
import org.slf4j.LoggerFactory
import scala.annotation.tailrec
/**
@@ -15,10 +18,11 @@ import scala.annotation.tailrec
object LDAPUtil {
private val LDAP_VERSION: Int = LDAPConnection.LDAP_V3
private val logger = LoggerFactory.getLogger(getClass().getName())
private val LDAP_DUMMY_MAL = "@ldap-devnull"
private val logger = LoggerFactory.getLogger(getClass().getName())
private val provider = new AtomicReference[Provider](null)
/**
* Returns true if mail address ends with "@ldap-devnull"
*/
@@ -120,6 +124,17 @@ object LDAPUtil {
}).replaceAll("[^a-zA-Z0-9\\-_.]", "").replaceAll("^[_\\-]", "")
}
private def getSslProvider(): Provider = {
val cachedInstance = provider.get()
if (cachedInstance == null) {
val newInstance = Class.forName("com.sun.net.ssl.internal.ssl.Provider").newInstance().asInstanceOf[Provider]
provider.compareAndSet(null, newInstance)
newInstance
} else {
cachedInstance
}
}
private def bind[A](
host: String,
port: Int,
@@ -132,7 +147,7 @@ object LDAPUtil {
)(f: LDAPConnection => Either[String, A]): Either[String, A] = {
if (tls) {
// Dynamically set Sun as the security provider
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider())
Security.addProvider(getSslProvider())
if (keystore.compareTo("") != 0) {
// Dynamically set the property that JSSE uses to identify

View File

@@ -7,7 +7,7 @@
<div class="panel-heading">
<span class="monospace">@comments.fileName</span>
@if(!latestCommitId.contains(comments.comments.head.commitId)) {
<span class="pull-right"><a href="javascript:$('.fold-comments-@comments.comments.head.commentId').toggle();"><i class="octicon octicon-unfold"></i></a></span>
<span class="pull-right"><a href="javascript:void(0);" onclick="$('.fold-comments-@comments.comments.head.commentId').toggle();"><i class="octicon octicon-unfold"></i></a></span>
}
</div>
<div style="@if(!latestCommitId.contains(comments.comments.head.commitId)){display: none;}" class="fold-comments-@comments.comments.head.commentId">

View File

@@ -103,8 +103,8 @@
} else {
@if(diff.newContent != None || diff.oldContent != None){
<div id="diffText-@i" class="diffText"></div>
<textarea id="newText-@i" style="display: none;" data-file-name="@diff.oldPath" data-val='@diff.newContent.getOrElse("")'></textarea>
<textarea id="oldText-@i" style="display: none;" data-file-name="@diff.newPath" data-val='@diff.oldContent.getOrElse("")'></textarea>
<input type="hidden" id="newText-@i" data-file-name="@diff.oldPath" value="@diff.newContent">
<input type="hidden" id="oldText-@i" data-file-name="@diff.newPath" value="@diff.oldContent">
} else {
@if(diff.newIsImage || diff.oldIsImage){
<div class="diff-image-render diff2up">

View File

@@ -25,7 +25,7 @@
<form method="GET" action="@helpers.url(repository)/search" id="search-filter-form" class="form-inline pull-right" autocomplete="off">
<div class="input-group">
<input type="text" class="form-control" name="q" placeholder="Search..."/>
<input type="hidden" name="type" value="issue"/>
<input type="hidden" name="type" value="@target"/>
<span class="input-group-btn">
<button type="submit" id="search-btn" class="btn btn-default"><i class="fa fa-search"></i></button>
</span>

View File

@@ -10,7 +10,7 @@
@if(!status.statuses.isEmpty){
<div class="build-statuses">
@defining(status.commitStateSummary){ case (summaryState, summary) =>
<a class="pull-right" id="toggle-all-checks"></a>
<a class="pull-right" id="toggle-all-checks" href="javascript:void(0);"></a>
<span class="build-status-icon text-@{summaryState.name}">@helpers.commitStateIcon(summaryState)</span>
<strong class="text-@{summaryState.name}">@helpers.commitStateText(summaryState, pullreq.commitIdTo)</strong>
<span class="text-@{summaryState.name}">— @summary checks</span>

View File

@@ -6,17 +6,22 @@
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
diffs: Seq[gitbucket.core.util.JGitUtil.DiffInfo],
oldCommitId: Option[String],
hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context)
hasWritePermission: Boolean,
info: Option[Any] = None,
error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
@import gitbucket.core.view.helpers.RichHtmlSeq
@import gitbucket.core.model._
@gitbucket.core.html.main(commit.shortMessage, Some(repository)){
@gitbucket.core.html.menu("files", repository){
@gitbucket.core.html.menu("files", repository, None, info, error){
<table class="table table-bordered">
<tr>
<th class="box-header">
<div class="pull-right align-right">
<div class="pull-right align-right btn-group">
<a href="@helpers.url(repository)/tree/@commit.id" class="btn btn-default">Browse code</a>
@if(hasWritePermission) {
<a href="@helpers.url(repository)/tag/@commit.id" class="btn btn-default" rel="facebox">Add tag</a>
}
</div>
<div class="commit-log">@helpers.link(commit.summary, repository)</div>
@if(commit.description.isDefined){

View File

@@ -32,8 +32,8 @@
<tr>
<td>
<div id="diffText"></div>
<textarea id="newText" style="display: none;" data-file-name="@fileName"></textarea>
<textarea id="oldText" style="display: none;" data-file-name="@fileName">@content.content</textarea>
<input type="hidden" id="newText" data-file-name="@fileName" value="">
<input type="hidden" id="oldText" data-file-name="@fileName" value="@content.content">
</td>
</tr>
</table>
@@ -46,7 +46,7 @@
<input type="text" name="message" class="form-control"/>
</div>
<div style="text-align: right;">
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName((branch :: pathList).mkString("/"))" class="btn btn-default">Cancel</a>
<a href="@helpers.url(repository)/blob/@helpers.encodeRefName((branch :: pathList ::: List(fileName)).mkString("/"))" class="btn btn-default">Cancel</a>
<input type="submit" id="commitButton" class="btn btn-success" value="Commit changes"/>
</div>
</div>

View File

@@ -0,0 +1,26 @@
@(commitId: String,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
<h2 class="facebox-header">
Add tag
</h2>
<form action="@helpers.url(repository)/tag" id="tag" method="post" validate="true">
<fieldset style="margin-top: 20px;">
<div class="form-group">
<label class="control-label" for="tagName">Tag name</label>
<input type="text" id="tagName" name="tagName" class="form-control">
<span class="error" id="error-tagName"></span>
</div>
</fieldset>
<fieldset>
<div class="form-group">
<label class="control-label" for="message">Message</label>
<input type="text" id="message" name="message" class="form-control">
<span class="error" id="error-message"></span>
</div>
</fieldset>
<div class="text-right">
<input type="hidden" name="commitId" value="@commitId">
<input type="submit" class="btn btn-success" value="Add tag">
</div>
</form>

View File

@@ -1,21 +1,27 @@
@(issues: List[gitbucket.core.service.RepositorySearchService.IssueSearchResult],
pullRequest: Boolean,
query: String,
page: Int,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
@import gitbucket.core.service.RepositorySearchService
@gitbucket.core.html.main("Search Results", Some(repository)){
@gitbucket.core.search.html.menu("issues", query, repository){
@gitbucket.core.search.html.menu(if(pullRequest) "pulls" else "issues", query, repository){
@if(query.nonEmpty) {
@if(issues.isEmpty) {
<h4>We couldn't find any code matching '@query'</h4>
<h4>We couldn't find any @{if(pullRequest) "pull requests" else "issues"} matching '@query'</h4>
} else {
<h4>We've found @issues.size @helpers.plural(issues.size, "issue")</h4>
<h4>We've found @issues.size @helpers.plural(issues.size, if(pullRequest) "pull request" else "issue")</h4>
}
}
@issues.drop((page - 1) * RepositorySearchService.IssueLimit).take(RepositorySearchService.IssueLimit).map { issue =>
<div class="block">
<div class="pull-right muted">#@issue.issueId</div>
<div class="pull-right muted">
@if(issue.isClosed){
<span class="label label-danger">Closed</span>
}
#@issue.issueId
</div>
<h4 style="margin-top: 0px;"><a href="@helpers.url(repository)/@if(issue.isPullRequest){pull} else {issues}/@issue.issueId">@issue.title</a></h4>
@if(issue.highlightText.nonEmpty){
<pre>@Html(issue.highlightText)</pre>
@@ -31,6 +37,6 @@
</div>
}
@gitbucket.core.helper.html.paginator(page, issues.size, RepositorySearchService.IssueLimit, 10,
s"${helpers.url(repository)}/search?q=${helpers.urlEncode(query)}&type=issue")
s"${helpers.url(repository)}/search?q=${helpers.urlEncode(query)}&type=${if(pullRequest) "pulls" else "issues"}")
}
}
}

View File

@@ -6,7 +6,10 @@
<select class="form-control" name="type">
<option value="code" @if(active == "files"){ selected }>Files</option>
@if(repository.repository.options.issuesOption != "DISABLE") {
<option value="issue" @if(active == "issues"){ selected }>Issues</option>
<option value="issues" @if(active == "issues"){ selected }>Issues</option>
}
@if(repository.repository.options.issuesOption != "DISABLE") {
<option value="pulls" @if(active == "pulls"){ selected }>Pull requests</option>
}
@if(repository.repository.options.wikiOption != "DISABLE") {
<option value="wiki" @if(active == "wiki"){ selected }>Wiki</option>
@@ -17,4 +20,4 @@
<input type="hidden" name="type" value="@active"/>
</form>
@body
}
}

View File

@@ -8,7 +8,7 @@
@gitbucket.core.search.html.menu("wiki", query, repository){
@if(query.nonEmpty) {
@if(wikis.isEmpty) {
<h4>We could not find any code matching '@query'</h4>
<h4>We could not find any pages matching '@query'</h4>
} else {
<h4>We've found @wikis.size @helpers.plural(wikis.size, "page")</h4>
}
@@ -23,4 +23,4 @@
@gitbucket.core.helper.html.paginator(page, wikis.size, RepositorySearchService.CodeLimit, 10,
s"${helpers.url(repository)}/search?q=${helpers.urlEncode(query)}&type=wiki")
}
}
}

View File

@@ -78,9 +78,9 @@ function displayErrors(data, elem){
function diffUsingJS(oldTextId, newTextId, outputId, viewType, ignoreSpace) {
var old = $('#'+oldTextId), head = $('#' + newTextId);
var render = new JsDiffRender({
oldText: old.attr('data-val'),
oldText: old.val(),
oldTextName: old.attr('data-file-name'),
newText: head.attr('data-val'),
newText: head.val(),
newTextName: head.attr('data-file-name'),
ignoreSpace: ignoreSpace,
contextSize: 4