From 9ee71e9f25a41d52e18733cb3a6bd1c0f9029f03 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Sun, 30 Jul 2017 11:39:36 +0900 Subject: [PATCH] fix getMergedComment for PR API merged field. --- src/main/scala/gitbucket/core/service/IssuesService.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/gitbucket/core/service/IssuesService.scala b/src/main/scala/gitbucket/core/service/IssuesService.scala index a782ddee1..7d40baf1c 100644 --- a/src/main/scala/gitbucket/core/service/IssuesService.scala +++ b/src/main/scala/gitbucket/core/service/IssuesService.scala @@ -32,8 +32,12 @@ trait IssuesService { .list def getMergedComment(owner: String, repository: String, issueId: Int)(implicit s: Session): Option[(IssueComment, Account)] = { - getCommentsForApi(owner, repository, issueId) - .collectFirst { case (comment, account, _) if comment.action == "merged" => (comment, account) } + IssueComments.filter(_.byIssue(owner, repository, issueId)) + .filter(_.action === "merge".bind) + .join(Accounts).on { case t1 ~ t2 => t1.commentedUserName === t2.userName } + .map { case t1 ~ t2 => (t1, t2)} + .list + .collectFirst { case (comment, account) if comment.action == "merge" => (comment, account) } } def getComment(owner: String, repository: String, commentId: String)(implicit s: Session): Option[IssueComment] = {