diff --git a/README.md b/README.md index 0e71b2e..d7dc176 100644 --- a/README.md +++ b/README.md @@ -307,7 +307,3 @@ ### 1.0 - 04 Jul 2013 - This is a first public release - -Sponsors --------- -[![IntelliJ IDEA](https://www.jetbrains.com/idea/docs/logo_intellij_idea.png)](https://www.jetbrains.com/idea/) diff --git a/src/main/twirl/gitbucket/core/helper/preview.scala.html b/src/main/twirl/gitbucket/core/helper/preview.scala.html index d6df583..8d6f2fe 100644 --- a/src/main/twirl/gitbucket/core/helper/preview.scala.html +++ b/src/main/twirl/gitbucket/core/helper/preview.scala.html @@ -15,7 +15,7 @@ @import gitbucket.core._ @import gitbucket.core.view.helpers._
-
} +@issueOrPullRequest()={ @if(issue.isDefined && issue.get.isPullRequest)( "pull request" )else( "issue" ) } @comments.map { case comment: gitbucket.core.model.IssueComment => { - @if(comment.action != "close" && comment.action != "reopen" && comment.action != "delete_branch"){ + @if(comment.action != "close" && comment.action != "reopen" && comment.action != "delete_branch" + && comment.action != "commit" && comment.action != "refer"){
@avatar(comment.commentedUserName, 48)
@@ -42,7 +44,7 @@ @if(comment.action == "comment"){ commented } else { - @if(pullreq.isEmpty){ referenced the issue } else { referenced the pull request } + referenced the @issueOrPullRequest() } @helper.html.datetimeago(comment.registeredDate) @@ -53,79 +55,114 @@ } - @if(comment.action == "commit" && comment.content.split(" ").last.matches("[a-f0-9]{40}")){ - @defining(comment.content.substring(comment.content.length - 40)){ id => - @id.substring(0, 7) - } - }
- @if(comment.action == "commit" && comment.content.split(" ").last.matches("[a-f0-9]{40}")){ - @markdown( - markdown = comment.content.substring(0, comment.content.length - 41), - repository = repository, - enableWikiLink = false, - enableRefsLink = true, - enableLineBreaks = true, - enableTaskList = true, - hasWritePermission = hasWritePermission - ) - } else { - @if(comment.action == "refer"){ - @defining(comment.content.split(":")){ case Array(issueId, rest @ _*) => - @issueLink(repository, issueId.toInt): @rest.mkString(":") - } - } else { - @markdown( - markdown = comment.content, - repository = repository, - enableWikiLink = false, - enableRefsLink = true, - enableLineBreaks = true, - enableTaskList = true, - hasWritePermission = hasWritePermission - ) + @markdown( + markdown = comment.content, + repository = repository, + enableWikiLink = false, + enableRefsLink = true, + enableLineBreaks = true, + enableTaskList = true, + hasWritePermission = hasWritePermission + ) +
+
+ } + @if(comment.action == "commit"){ + @defining({ + val (content, id) = " ([a-f0-9]{40})$".r.findFirstMatchIn(comment.content) + .map(m => (m.before.toString -> Some(m.group(1)))) + .getOrElse(comment.content -> None) + val head = content.take(100).takeWhile(_ != '\n') + (id, head, if(head == content){ None }else{ Some(content.drop(head.length).dropWhile(_ == '\n')) }.filter(_.nonEmpty)) + }){ case (commitId, head, rest) => +
+
+ + @avatar(comment.commentedUserName, 16) + @user(comment.commentedUserName, styleClass="username strong") + added a commit that referenced this @issueOrPullRequest() + @helper.html.datetimeago(comment.registeredDate) +
+
+ @commitId.map{ id => + @id.substring(0, 7) } + + @link(head, repository) + @rest.map{ content => + ... + + } +
+
+ } + } + @if(comment.action == "refer"){ +
+
+ + @avatar(comment.commentedUserName, 16) + @user(comment.commentedUserName, styleClass="username strong") + referenced the @issueOrPullRequest() + @helper.html.datetimeago(comment.registeredDate) +
+
+ @defining(comment.content.split(":")){ case Array(issueId, rest @ _*) => + @issueLink(repository, issueId.toInt): @rest.mkString(":") }
} @if(comment.action == "merge"){ -
- Merged - @avatar(comment.commentedUserName, 20) - @user(comment.commentedUserName, styleClass="username strong") merged commit @pullreq.map(_.commitIdTo.substring(0, 7)) into - @if(pullreq.get.requestUserName == repository.owner){ - @pullreq.map(_.branch) from @pullreq.map(_.requestBranch) - } else { - @pullreq.map(_.userName):@pullreq.map(_.branch) from @pullreq.map(_.requestUserName):@pullreq.map(_.requestBranch) - } - @helper.html.datetimeago(comment.registeredDate) +
+
+ + @avatar(comment.commentedUserName, 16) + @user(comment.commentedUserName, styleClass="username strong") + merged commit + @pullreq.map(_.commitIdTo.substring(0, 7)) into + @if(pullreq.get.requestUserName == repository.owner){ + @pullreq.map(_.branch) from @pullreq.map(_.requestBranch) + } else { + @pullreq.map(_.userName):@pullreq.map(_.branch) from @pullreq.map(_.requestUserName):@pullreq.map(_.requestBranch) + } + @helper.html.datetimeago(comment.registeredDate) +
} @if(comment.action == "close" || comment.action == "close_comment"){ -
- - @avatar(comment.commentedUserName, 20) - @if(issue.isDefined && issue.get.isPullRequest){ - @user(comment.commentedUserName, styleClass="username strong") closed the pull request @helper.html.datetimeago(comment.registeredDate) - } else { - @user(comment.commentedUserName, styleClass="username strong") closed the issue @helper.html.datetimeago(comment.registeredDate) - } +
+
+ + @avatar(comment.commentedUserName, 16) + @user(comment.commentedUserName, styleClass="username strong") + close @issueOrPullRequest() + @helper.html.datetimeago(comment.registeredDate) +
} @if(comment.action == "reopen" || comment.action == "reopen_comment"){ -
- - @avatar(comment.commentedUserName, 20) - @user(comment.commentedUserName, styleClass="username strong") reopened the issue @helper.html.datetimeago(comment.registeredDate) +
+
+ + @avatar(comment.commentedUserName, 16) + @user(comment.commentedUserName, styleClass="username strong") + reopened the @issueOrPullRequest() + @helper.html.datetimeago(comment.registeredDate) +
} @if(comment.action == "delete_branch"){ -
- Deleted - @avatar(comment.commentedUserName, 20) - @user(comment.commentedUserName, styleClass="username strong") deleted the @pullreq.map(_.requestBranch) branch @helper.html.datetimeago(comment.registeredDate) +
+
+ + @avatar(comment.commentedUserName, 16) + @user(comment.commentedUserName, styleClass="username strong") + deleted the @pullreq.map(_.requestBranch) branch + @helper.html.datetimeago(comment.registeredDate) +
} } diff --git a/src/main/twirl/gitbucket/core/menu.scala.html b/src/main/twirl/gitbucket/core/menu.scala.html index 8a95986..cd584f1 100644 --- a/src/main/twirl/gitbucket/core/menu.scala.html +++ b/src/main/twirl/gitbucket/core/menu.scala.html @@ -105,7 +105,7 @@ } }
-
+
@if(expand){ @repository.repository.description.map { description =>

@detectAndRenderLinks(description)

diff --git a/src/main/twirl/gitbucket/core/wiki/compare.scala.html b/src/main/twirl/gitbucket/core/wiki/compare.scala.html index 7da312b..ea76b3e 100644 --- a/src/main/twirl/gitbucket/core/wiki/compare.scala.html +++ b/src/main/twirl/gitbucket/core/wiki/compare.scala.html @@ -10,7 +10,7 @@ @html.main(s"Compare Revisions - ${repository.owner}/${repository.name}", Some(repository)){ @helper.html.information(info) @html.menu("wiki", repository){ -