diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 78d6161..57546bf 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -532,6 +532,13 @@ func (h *Handler) PullDetail(w http.ResponseWriter, r *http.Request) { } } + // Fetch comments for this PR (Gitea uses the issues endpoint for PR comments). + comments, err := h.Client.GetIssueComments(r.Context(), token, owner, repo, index) + if err != nil { + slog.Warn("failed to fetch PR comments", "error", err, "owner", owner, "repo", repo, "index", index) + // Non-fatal: continue rendering without comments. + } + // Build the content HTML using the template. tmpl, err := template.ParseFiles("internal/templates/pull_detail.html") if err != nil { @@ -543,11 +550,13 @@ func (h *Handler) PullDetail(w http.ResponseWriter, r *http.Request) { type templateData struct { Pull *giteaclient.PullRequest RenderedBody template.HTML + Comments []giteaclient.Comment } data := templateData{ Pull: pr, RenderedBody: renderedBody, + Comments: comments, } var buf strings.Builder diff --git a/internal/templates/pull_detail.html b/internal/templates/pull_detail.html index 1fea88a..773675e 100644 --- a/internal/templates/pull_detail.html +++ b/internal/templates/pull_detail.html @@ -46,4 +46,21 @@ + +{{if .Comments}} +
No comments yet.
+{{end}} {{end}}