diff options
author | Edip Emre Bodur <38386056+emrebdr@users.noreply.github.com> | 2024-08-05 13:59:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-05 10:59:53 +0000 |
commit | 94cca8846e7d62c8a295d70c8199d706dfa60e5c (patch) | |
tree | 86691511936071c36d243ae61a12485da51ffa2d /services | |
parent | c649a04da14ea46b57ec96ce95848f4289728d8a (diff) | |
download | gitea-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.go | 15 |
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() } |