diff --git a/src/main/scala/gitbucket/core/controller/PullRequestsController.scala b/src/main/scala/gitbucket/core/controller/PullRequestsController.scala index 2888602..f06e4d5 100644 --- a/src/main/scala/gitbucket/core/controller/PullRequestsController.scala +++ b/src/main/scala/gitbucket/core/controller/PullRequestsController.scala @@ -494,8 +494,7 @@ (repository.userName, repository.repositoryName, repository.defaultBranch) }, commits.flatten - .map(commit => getCommitComments(forkedRepository.owner, forkedRepository.name, commit.id, false)) - .flatten + .flatMap(commit => getCommitComments(forkedRepository.owner, forkedRepository.name, commit.id, false)) .toList, originId, forkedId, diff --git a/src/main/scala/gitbucket/core/service/PullRequestService.scala b/src/main/scala/gitbucket/core/service/PullRequestService.scala index c9dd238..65d134c 100644 --- a/src/main/scala/gitbucket/core/service/PullRequestService.scala +++ b/src/main/scala/gitbucket/core/service/PullRequestService.scala @@ -509,10 +509,11 @@ def getPullRequestComments(userName: String, repositoryName: String, issueId: Int, commits: Seq[CommitInfo])( implicit s: Session ): Seq[Comment] = { - (commits - .map(commit => getCommitComments(userName, repositoryName, commit.id, true)) - .flatten ++ getComments(userName, repositoryName, issueId)) - .groupBy { + (commits.flatMap(commit => getCommitComments(userName, repositoryName, commit.id, true)) ++ getComments( + userName, + repositoryName, + issueId + )).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.originalOldLine, x.originalNewLine) diff --git a/src/main/scala/gitbucket/core/service/WikiService.scala b/src/main/scala/gitbucket/core/service/WikiService.scala index 7fde851..3f6d848 100644 --- a/src/main/scala/gitbucket/core/service/WikiService.scala +++ b/src/main/scala/gitbucket/core/service/WikiService.scala @@ -145,7 +145,7 @@ if (!p.getErrors.isEmpty) { throw new PatchFormatException(p.getErrors()) } - val revertInfo = (p.getFiles.asScala.map { fh => + val revertInfo = p.getFiles.asScala.flatMap { fh => fh.getChangeType match { case DiffEntry.ChangeType.MODIFY => { val source = @@ -174,7 +174,7 @@ } case _ => Nil } - }).flatten + } if (revertInfo.nonEmpty) { val builder = DirCache.newInCore.builder()