diff --git a/appview/pages/compose_parse_test.go b/appview/pages/compose_parse_test.go --- a/appview/pages/compose_parse_test.go +++ b/appview/pages/compose_parse_test.go @@ -31,7 +31,6 @@ {"pullCompareBranches", []string{"repo/pulls/fragments/pullCompareBranches"}}, {"pullCompareForksBranches", []string{"repo/pulls/fragments/pullCompareForksBranches"}}, {"pull.html via repo base", []string{"layouts/base", "layouts/repobase", "repo/pulls/pull"}}, - {"pullNewComment", []string{"repo/pulls/fragments/pullNewComment"}}, {"pullComment", []string{"fragments/comment/pullComment"}}, } diff --git a/appview/pages/pages.go b/appview/pages/pages.go --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -1586,17 +1586,6 @@ return p.executePlain("repo/pulls/fragments/pullActions", w, params) } -type PullNewCommentParams struct { - BaseParams - RepoInfo repoinfo.RepoInfo - Pull *models.Pull - RoundNumber int -} - -func (p *Pages) PullNewCommentFragment(w io.Writer, params PullNewCommentParams) error { - return p.executePlain("repo/pulls/fragments/pullNewComment", w, params) -} - type RepoCompareParams struct { BaseParams RepoInfo repoinfo.RepoInfo diff --git a/appview/pulls/comment.go b/appview/pulls/comment.go deleted file mode 100644 --- a/appview/pulls/comment.go +++ /dev/null @@ -1,47 +0,0 @@ -package pulls - -import ( - "net/http" - "strconv" - - "tangled.org/core/appview/models" - "tangled.org/core/appview/pages" - - "github.com/go-chi/chi/v5" -) - -func (s *Pulls) PullComment(w http.ResponseWriter, r *http.Request) { - l := s.logger.With("handler", "PullComment") - - user := s.oauth.GetMultiAccountUser(r) - if user != nil { - l = l.With("user", user.Did) - } - - pull, ok := r.Context().Value("pull").(*models.Pull) - if !ok { - l.Error("failed to get pull") - s.pages.Notice(w, "pull-error", "Failed to edit patch. Try again later.") - return - } - l = l.With("pull_id", pull.PullId, "pull_owner", pull.OwnerDid) - - roundNumberStr := chi.URLParam(r, "round") - roundNumber, err := strconv.Atoi(roundNumberStr) - if err != nil || roundNumber < 0 || roundNumber >= len(pull.Submissions) { - http.Error(w, "bad round id", http.StatusBadRequest) - l.Error("failed to parse round id", "err", err, "round_number_str", roundNumberStr) - return - } - - switch r.Method { - case http.MethodGet: - s.pages.PullNewCommentFragment(w, pages.PullNewCommentParams{ - BaseParams: pages.BaseParamsFromContext(r.Context()), - RepoInfo: s.repoResolver.GetRepoInfo(r, user), - Pull: pull, - RoundNumber: roundNumber, - }) - return - } -} diff --git a/appview/pulls/router.go b/appview/pulls/router.go --- a/appview/pulls/router.go +++ b/appview/pulls/router.go @@ -26,7 +26,6 @@ r.Get("/", s.RepoPullPatch) r.Get("/interdiff", s.RepoPullInterdiff) r.Get("/actions", s.PullActions) - r.Get("/comment", s.PullComment) }) r.Route("/round/{round}.patch", func(r chi.Router) { diff --git a/appview/pages/templates/repo/pulls/fragments/pullActions.html b/appview/pages/templates/repo/pulls/fragments/pullActions.html --- a/appview/pages/templates/repo/pulls/fragments/pullActions.html +++ b/appview/pages/templates/repo/pulls/fragments/pullActions.html @@ -37,19 +37,51 @@ {{ if and (not $loading) $isLastRound }} {{ template "resubmitStatus" . }} {{ end }} -
+