MCPcopy
hub / github.com/harness/harness / HandleCommentStatus

Function HandleCommentStatus

app/api/handler/pullreq/comment_status.go:27–65  ·  view source on GitHub ↗

HandleCommentStatus is an HTTP handler for updating a pull request comment status.

(pullreqCtrl *pullreq.Controller)

Source from the content-addressed store, hash-verified

25
26// HandleCommentStatus is an HTTP handler for updating a pull request comment status.
27func HandleCommentStatus(pullreqCtrl *pullreq.Controller) http.HandlerFunc {
28 return func(w http.ResponseWriter, r *http.Request) {
29 ctx := r.Context()
30 session, _ := request.AuthSessionFrom(ctx)
31
32 repoRef, err := request.GetRepoRefFromPath(r)
33 if err != nil {
34 render.TranslatedUserError(ctx, w, err)
35 return
36 }
37
38 pullreqNumber, err := request.GetPullReqNumberFromPath(r)
39 if err != nil {
40 render.TranslatedUserError(ctx, w, err)
41 return
42 }
43
44 commentID, err := request.GetPullReqCommentIDPath(r)
45 if err != nil {
46 render.TranslatedUserError(ctx, w, err)
47 return
48 }
49
50 in := new(pullreq.CommentStatusInput)
51 err = json.NewDecoder(r.Body).Decode(in)
52 if err != nil {
53 render.BadRequestf(ctx, w, "Invalid Request Body: %s.", err)
54 return
55 }
56
57 comment, err := pullreqCtrl.CommentStatus(ctx, session, repoRef, pullreqNumber, commentID, in)
58 if err != nil {
59 render.TranslatedUserError(ctx, w, err)
60 return
61 }
62
63 render.JSON(w, http.StatusOK, comment)
64 }
65}

Callers

nothing calls this directly

Calls 9

AuthSessionFromFunction · 0.92
GetRepoRefFromPathFunction · 0.92
TranslatedUserErrorFunction · 0.92
GetPullReqNumberFromPathFunction · 0.92
GetPullReqCommentIDPathFunction · 0.92
BadRequestfFunction · 0.92
JSONFunction · 0.92
CommentStatusMethod · 0.80
DecodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…