(pullreqCtrl *pullreq.Controller)
| 24 | ) |
| 25 | |
| 26 | func HandleRevert(pullreqCtrl *pullreq.Controller) http.HandlerFunc { |
| 27 | return func(w http.ResponseWriter, r *http.Request) { |
| 28 | ctx := r.Context() |
| 29 | session, _ := request.AuthSessionFrom(ctx) |
| 30 | |
| 31 | repoRef, err := request.GetRepoRefFromPath(r) |
| 32 | if err != nil { |
| 33 | render.TranslatedUserError(ctx, w, err) |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | in := new(pullreq.RevertInput) |
| 38 | err = json.NewDecoder(r.Body).Decode(in) |
| 39 | if err != nil { |
| 40 | render.BadRequestf(ctx, w, "Invalid Request Body: %s.", err) |
| 41 | return |
| 42 | } |
| 43 | |
| 44 | pullreqNumber, err := request.GetPullReqNumberFromPath(r) |
| 45 | if err != nil { |
| 46 | render.TranslatedUserError(ctx, w, err) |
| 47 | return |
| 48 | } |
| 49 | |
| 50 | pr, err := pullreqCtrl.Revert(ctx, session, repoRef, pullreqNumber, in) |
| 51 | if err != nil { |
| 52 | render.TranslatedUserError(ctx, w, err) |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | render.JSON(w, http.StatusOK, pr) |
| 57 | } |
| 58 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…