mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-12-26 18:29:53 +01:00
(refs #2209) Aggregate the line separator conversion to StringUtil
This commit is contained in:
@@ -9,6 +9,7 @@ import gitbucket.core.util.SyntaxSugars._
|
||||
import gitbucket.core.util.Directory._
|
||||
import gitbucket.core.util.Implicits._
|
||||
import gitbucket.core.util.JGitUtil
|
||||
import gitbucket.core.util.StringUtil._
|
||||
import gitbucket.core.util.JGitUtil.{CommitInfo, DiffInfo}
|
||||
import gitbucket.core.view
|
||||
import gitbucket.core.view.helpers
|
||||
@@ -267,8 +268,8 @@ trait PullRequestService {
|
||||
.map { diff =>
|
||||
(diff.oldContent, diff.newContent) match {
|
||||
case (Some(oldContent), Some(newContent)) => {
|
||||
val oldLines = oldContent.replace("\r\n", "\n").split("\n")
|
||||
val newLines = newContent.replace("\r\n", "\n").split("\n")
|
||||
val oldLines = convertLineSeparator(oldContent, "LF").split("\n")
|
||||
val newLines = convertLineSeparator(newContent, "LF").split("\n")
|
||||
file -> Option(DiffUtils.diff(oldLines.toList.asJava, newLines.toList.asJava))
|
||||
}
|
||||
case _ =>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
commitId: Option[String] = None,
|
||||
renderScript: Boolean = true)(implicit context: gitbucket.core.controller.Context)
|
||||
@import gitbucket.core.view.helpers
|
||||
@import gitbucket.core.util.StringUtil._
|
||||
@issueOrPullRequest()={ @if(issue.exists(_.isPullRequest))( "pull request" )else( "issue" ) }
|
||||
@showFormattedComment(comment: gitbucket.core.model.IssueComment)={
|
||||
<div class="panel panel-default issue-comment-box" id="comment-@comment.commentId">
|
||||
@@ -237,7 +238,7 @@
|
||||
<span class="discussion-item-icon"><i class="octicon octicon-pencil"></i></span>
|
||||
@helpers.avatar(comment.commentedUserName, 16)
|
||||
@helpers.user(comment.commentedUserName, styleClass="username strong")
|
||||
change title from <code>@comment.content.split("\r\n")(0)</code> to <code>@comment.content.split("\r\n")(1)</code>
|
||||
change title from <code>@convertLineSeparator(comment.content, "LF").split("\n")(0)</code> to <code>@convertLineSeparator(comment.content, "LF").split("\n")(1)</code>
|
||||
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user