diff options
author | pricly-yellow <79628427+pricly-yellow@users.noreply.github.com> | 2021-10-07 07:03:37 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-07 02:03:37 +0200 |
commit | 4afdb1eb78ce77fad8e1d2952c69b3315a836548 (patch) | |
tree | ce3c95b6bdf61da50fc0773e8ca3a5f3be73b8a0 /routers/api/v1/repo/pull.go | |
parent | 67bc04fe21e279805f2f4163791e28272e8133b1 (diff) | |
download | gitea-4afdb1eb78ce77fad8e1d2952c69b3315a836548.tar.gz gitea-4afdb1eb78ce77fad8e1d2952c69b3315a836548.zip |
API pull's head/base have correct permission (#17214)
close #17181
* for all pull requests API return permissions of caller
* for all webhook return empty permissions
Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/api/v1/repo/pull.go')
-rw-r--r-- | routers/api/v1/repo/pull.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 6718224d7d..d8e0d8099a 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -115,7 +115,7 @@ func ListPullRequests(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "LoadHeadRepo", err) return } - apiPrs[i] = convert.ToAPIPullRequest(prs[i]) + apiPrs[i] = convert.ToAPIPullRequest(prs[i], ctx.User) } ctx.SetLinkHeader(int(maxResults), listOptions.PageSize) @@ -171,7 +171,7 @@ func GetPullRequest(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "LoadHeadRepo", err) return } - ctx.JSON(http.StatusOK, convert.ToAPIPullRequest(pr)) + ctx.JSON(http.StatusOK, convert.ToAPIPullRequest(pr, ctx.User)) } // DownloadPullDiffOrPatch render a pull's raw diff or patch @@ -417,7 +417,7 @@ func CreatePullRequest(ctx *context.APIContext) { } log.Trace("Pull request created: %d/%d", repo.ID, prIssue.ID) - ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr)) + ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr, ctx.User)) } // EditPullRequest does what it says @@ -624,7 +624,7 @@ func EditPullRequest(ctx *context.APIContext) { } // TODO this should be 200, not 201 - ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr)) + ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr, ctx.User)) } // IsPullRequestMerged checks if a PR exists given an index |