aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEdip Emre Bodur <38386056+emrebdr@users.noreply.github.com>2024-08-05 13:59:53 +0300
committerGitHub <noreply@github.com>2024-08-05 10:59:53 +0000
commit94cca8846e7d62c8a295d70c8199d706dfa60e5c (patch)
tree86691511936071c36d243ae61a12485da51ffa2d /services
parentc649a04da14ea46b57ec96ce95848f4289728d8a (diff)
downloadgitea-94cca8846e7d62c8a295d70c8199d706dfa60e5c.tar.gz
gitea-94cca8846e7d62c8a295d70c8199d706dfa60e5c.zip
Fix null requested_reviewer from API (#31773)
If the assign the pull request review to a team, it did not show the members of the team in the "requested_reviewers" field, so the field was null. As a solution, I added the team members to the array. fix #31764
Diffstat (limited to 'services')
-rw-r--r--services/convert/pull.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/services/convert/pull.go b/services/convert/pull.go
index c214805ed5..4ec24a8276 100644
--- a/services/convert/pull.go
+++ b/services/convert/pull.go
@@ -106,10 +106,25 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u
log.Error("LoadRequestedReviewers[%d]: %v", pr.ID, err)
return nil
}
+ if err = pr.LoadRequestedReviewersTeams(ctx); err != nil {
+ log.Error("LoadRequestedReviewersTeams[%d]: %v", pr.ID, err)
+ return nil
+ }
+
for _, reviewer := range pr.RequestedReviewers {
apiPullRequest.RequestedReviewers = append(apiPullRequest.RequestedReviewers, ToUser(ctx, reviewer, nil))
}
+ for _, reviewerTeam := range pr.RequestedReviewersTeams {
+ convertedTeam, err := ToTeam(ctx, reviewerTeam, true)
+ if err != nil {
+ log.Error("LoadRequestedReviewersTeams[%d]: %v", pr.ID, err)
+ return nil
+ }
+
+ apiPullRequest.RequestedReviewersTeams = append(apiPullRequest.RequestedReviewersTeams, convertedTeam)
+ }
+
if pr.Issue.ClosedUnix != 0 {
apiPullRequest.Closed = pr.Issue.ClosedUnix.AsTimePtr()
}