From 9e1834f2f939a0f9406011db19be79a6cd202fdc Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Tue, 30 Jun 2026 08:54:48 +0000 Subject: [PATCH] appview: fix comment redirect behavior Signed-off-by: Seongmin Lee --- appview/pages/url.go | 4 ++-- appview/state/comment.go | 7 +++---- appview/pages/templates/repo/pulls/fragments/pullNewComment.html | 1 + 3 file(s) changed, 6 insertion(s)(+), 6 deletion(s)(-) diff --git a/appview/pages/url.go b/appview/pages/url.go --- a/appview/pages/url.go +++ b/appview/pages/url.go @@ -65,7 +65,7 @@ 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 @@ 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 --- a/appview/state/comment.go +++ b/appview/state/comment.go @@ -303,12 +303,11 @@ 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()) diff --git a/appview/pages/templates/repo/pulls/fragments/pullNewComment.html b/appview/pages/templates/repo/pulls/fragments/pullNewComment.html --- 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'})" > -- tangled.sh