mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
Exclude some actions from comment count at the repository search result.
This commit is contained in:
@@ -252,7 +252,8 @@ trait IssuesService {
|
|||||||
// Search Issue
|
// Search Issue
|
||||||
val issues = Query(Issues).filter { t =>
|
val issues = Query(Issues).filter { t =>
|
||||||
keywords.map { keyword =>
|
keywords.map { keyword =>
|
||||||
(t.title.toLowerCase like (s"%${likeEncode(keyword)}%", '^')) || (t.content.toLowerCase like (s"%${likeEncode(keyword)}%", '^'))
|
(t.title.toLowerCase like (s"%${likeEncode(keyword)}%", '^')) ||
|
||||||
|
(t.content.toLowerCase like (s"%${likeEncode(keyword)}%", '^'))
|
||||||
} .reduceLeft(_ && _)
|
} .reduceLeft(_ && _)
|
||||||
}.map { t => (t, 0, t.content) }
|
}.map { t => (t, 0, t.content) }
|
||||||
|
|
||||||
@@ -265,10 +266,12 @@ trait IssuesService {
|
|||||||
}.reduceLeft(_ && _)
|
}.reduceLeft(_ && _)
|
||||||
}.map { case (t1, t2) => (t2, t1.commentId, t1.content) }
|
}.map { case (t1, t2) => (t2, t1.commentId, t1.content) }
|
||||||
|
|
||||||
// TODO Excludes some actions which should be ignored.
|
|
||||||
def getCommentCount(issue: Issue): Int = {
|
def getCommentCount(issue: Issue): Int = {
|
||||||
Query(IssueComments)
|
Query(IssueComments)
|
||||||
.filter(_.byIssue(issue.userName, issue.repositoryName, issue.issueId))
|
.filter { t =>
|
||||||
|
t.byIssue(issue.userName, issue.repositoryName, issue.issueId) &&
|
||||||
|
(t.action inSetBind Seq("comment", "close_comment", "reopen_comment"))
|
||||||
|
}
|
||||||
.map(_.issueId)
|
.map(_.issueId)
|
||||||
.list.length
|
.list.length
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user