Show original author's reviews on pull summary box (#13127)
follow #12039, show original author's reviews by other way. fix #11705. Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
parent
e70df67d47
commit
97980146c5
4 changed files with 53 additions and 2 deletions
|
@ -486,6 +486,20 @@ func GetReviewersByIssueID(issueID int64) ([]*Review, error) {
|
|||
return reviews, nil
|
||||
}
|
||||
|
||||
// GetReviewersFromOriginalAuthorsByIssueID gets the latest review of each original authors for a pull request
|
||||
func GetReviewersFromOriginalAuthorsByIssueID(issueID int64) ([]*Review, error) {
|
||||
reviews := make([]*Review, 0, 10)
|
||||
|
||||
// Get latest review of each reviwer, sorted in order they were made
|
||||
if err := x.SQL("SELECT * FROM review WHERE id IN (SELECT max(id) as id FROM review WHERE issue_id = ? AND reviewer_team_id = 0 AND type in (?, ?, ?) AND original_author_id <> 0 GROUP BY issue_id, original_author_id) ORDER BY review.updated_unix ASC",
|
||||
issueID, ReviewTypeApprove, ReviewTypeReject, ReviewTypeRequest).
|
||||
Find(&reviews); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return reviews, nil
|
||||
}
|
||||
|
||||
// GetReviewByIssueIDAndUserID get the latest review of reviewer for a pull request
|
||||
func GetReviewByIssueIDAndUserID(issueID, userID int64) (*Review, error) {
|
||||
return getReviewByIssueIDAndUserID(x, issueID, userID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue