diff --git a/appview/pages/templates/repo/pulls/fragments/pullNewComment.html b/appview/pages/templates/repo/pulls/fragments/pullNewComment.html index bae06cfd..034aec8a 100644 --- a/appview/pages/templates/repo/pulls/fragments/pullNewComment.html +++ b/appview/pages/templates/repo/pulls/fragments/pullNewComment.html @@ -8,6 +8,7 @@ hx-target="#pull-comments-{{ .RoundNumber }}" hx-swap="beforeend" hx-disabled-elt="find button[type='submit']" + hx-on::after-request="if(event.detail.successful) htmx.ajax('GET', '/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ .RoundNumber }}/actions', {target: '#actions-{{ .RoundNumber }}', swap: 'outerHTML'})" > diff --git a/appview/pages/url.go b/appview/pages/url.go index c1531d86..d54a7106 100644 --- a/appview/pages/url.go +++ b/appview/pages/url.go @@ -65,7 +65,7 @@ func (p *Pages) MakeIssueUrl(ctx context.Context, uri syntax.ATURI) (string, err if err != nil { return "", fmt.Errorf("failed to make repo url: %w", err) } - return path.Join(repoUrl, "issues", strconv.FormatInt(issue.Id, 10)), nil + return path.Join(repoUrl, "issues", strconv.Itoa(issue.IssueId)), nil } func (p *Pages) MakePullUrl(ctx context.Context, uri syntax.ATURI, roundIdx int) (string, error) { @@ -77,7 +77,7 @@ func (p *Pages) MakePullUrl(ctx context.Context, uri syntax.ATURI, roundIdx int) if err != nil { return "", fmt.Errorf("failed to make repo url: %w", err) } - return path.Join(repoUrl, "pulls", strconv.Itoa(pull.ID), "rounds", strconv.Itoa(roundIdx)), nil + return path.Join(repoUrl, "pulls", strconv.Itoa(pull.PullId), "rounds", strconv.Itoa(roundIdx)), nil } func (p *Pages) makeRepoUrlInner(ctx context.Context, repo *models.Repo) (string, error) { diff --git a/appview/state/comment.go b/appview/state/comment.go index f54e55e3..7af5a29a 100644 --- a/appview/state/comment.go +++ b/appview/state/comment.go @@ -303,12 +303,11 @@ func (s *State) NewComment(w http.ResponseWriter, r *http.Request) { Comment: comment, }); err != nil { l.Error("failed to render pull comment fragment", "err", err) - s.pages.HxRefresh(w) + } else { + w.Header().Set("Content-Type", "text/html") + w.Write(buf.Bytes()) return } - w.Header().Set("Content-Type", "text/html") - w.Write(buf.Bytes()) - return } target, err := s.pages.MakeCommentUrl(ctx, comment.AtUri())