diff options
author | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-10-09 07:02:20 +0200 |
---|---|---|
committer | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-10-09 07:02:20 +0200 |
commit | 31fc0f66b73b201a88b86bbd0c366feb0a5c9396 (patch) | |
tree | 6c187efe16be1e35f32fde393dc6a4ee265610f1 /services | |
parent | [Feat]Add link to show all Issues/PullRequests (#4125) (diff) | |
parent | Fix the logic of finding the latest pull review commit ID (#32139) (followup) (diff) | |
download | forgejo-31fc0f66b73b201a88b86bbd0c366feb0a5c9396.tar.xz forgejo-31fc0f66b73b201a88b86bbd0c366feb0a5c9396.zip |
Merge pull request '[gitea] week 2024-41 cherry pick (gitea/main -> forgejo)' (#5477) from earl-warren/wcp/2024-41 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5477
Reviewed-by: Otto <otto@codeberg.org>
Diffstat (limited to 'services')
-rw-r--r-- | services/pull/pull.go | 8 | ||||
-rw-r--r-- | services/pull/review.go | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go index 82ca0d7047..6af7d8ba0c 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -966,6 +966,8 @@ type CommitInfo struct { } // GetPullCommits returns all commits on given pull request and the last review commit sha +// Attention: The last review commit sha must be from the latest review whose commit id is not empty. +// So the type of the latest review cannot be "ReviewTypeRequest". func GetPullCommits(ctx *gitea_context.Context, issue *issues_model.Issue) ([]CommitInfo, string, error) { pull := issue.PullRequest @@ -1011,7 +1013,11 @@ func GetPullCommits(ctx *gitea_context.Context, issue *issues_model.Issue) ([]Co lastreview, err := issues_model.FindLatestReviews(ctx, issues_model.FindReviewOptions{ IssueID: issue.ID, ReviewerID: ctx.Doer.ID, - Type: issues_model.ReviewTypeUnknown, + Types: []issues_model.ReviewType{ + issues_model.ReviewTypeApprove, + issues_model.ReviewTypeComment, + issues_model.ReviewTypeReject, + }, }) if err != nil && !issues_model.IsErrReviewNotExist(err) { diff --git a/services/pull/review.go b/services/pull/review.go index 011c2a3058..927c43150b 100644 --- a/services/pull/review.go +++ b/services/pull/review.go @@ -340,7 +340,7 @@ func DismissApprovalReviews(ctx context.Context, doer *user_model.User, pull *is reviews, err := issues_model.FindReviews(ctx, issues_model.FindReviewOptions{ ListOptions: db.ListOptionsAll, IssueID: pull.IssueID, - Type: issues_model.ReviewTypeApprove, + Types: []issues_model.ReviewType{issues_model.ReviewTypeApprove}, Dismissed: optional.Some(false), }) if err != nil { |