From e64950879d89cf6447348b6585944fc10c84d8dd Mon Sep 17 00:00:00 2001 From: Ine Maria Nilssen Aanonsen Date: Fri, 6 Mar 2026 21:04:58 +0100 Subject: [PATCH] FIXED COMMENTS. TASK BACKLOG REFINEMENT ISSUE --- cmd/pm/tasks/backlogRefinement.go | 3 ++- internal/commands/issues/close.go | 3 +++ pkg/web/components/assignee_form_templ.go | 2 +- pkg/web/components/base/input_templ.go | 2 +- pkg/web/components/base/range_templ.go | 2 +- pkg/web/components/base/select_templ.go | 2 +- pkg/web/components/base/table_templ.go | 2 +- pkg/web/components/base/textarea_templ.go | 2 +- pkg/web/components/close_issue_form.templ | 5 +++-- pkg/web/components/close_issue_form_templ.go | 8 ++++---- pkg/web/components/comment_templ.go | 2 +- pkg/web/components/header_templ.go | 2 +- pkg/web/components/icons_templ.go | 2 +- pkg/web/components/issue_detail_templ.go | 2 +- pkg/web/components/issue_templ.go | 2 +- pkg/web/components/layout_templ.go | 2 +- pkg/web/components/modal_templ.go | 2 +- pkg/web/components/search_templ.go | 2 +- pkg/web/components/sidebar_templ.go | 2 +- pkg/web/components/status_templ.go | 2 +- pkg/web/handler/issues.go | 13 +++++++++++-- pkg/web/handler/modals.go | 18 +++++++++--------- pkg/web/routes/dashboard_templ.go | 2 +- pkg/web/routes/issue_detail_templ.go | 2 +- pkg/web/routes/layout_templ.go | 2 +- 25 files changed, 51 insertions(+), 37 deletions(-) diff --git a/cmd/pm/tasks/backlogRefinement.go b/cmd/pm/tasks/backlogRefinement.go index 5e7e150..f1ed46b 100644 --- a/cmd/pm/tasks/backlogRefinement.go +++ b/cmd/pm/tasks/backlogRefinement.go @@ -48,6 +48,7 @@ func (t *BacklogRefinementTask) Questions(interfaceType InterfaceType) Questions return BaseQuestions(interfaceType).With( huh.NewGroup( huh.NewSelect[int](). + Key("how-many-duplicate-issues"). Title("How many duplicate issues did you close during refinement?"). Options( huh.NewOption("1", 1), @@ -59,7 +60,7 @@ func (t *BacklogRefinementTask) Questions(interfaceType InterfaceType) Questions } func (t *BacklogRefinementTask) QuestionnaireKeys(_ InterfaceType) []string { - return []string{"task_completed", "task_difficulty"} + return []string{"task_completed", "task_difficulty", "how-many-duplicate-issues"} } func (t *BacklogRefinementTask) Setup(ctx context.Context) error { diff --git a/internal/commands/issues/close.go b/internal/commands/issues/close.go index 7af4b79..ce4bfcb 100644 --- a/internal/commands/issues/close.go +++ b/internal/commands/issues/close.go @@ -56,6 +56,9 @@ func runCloseCmd(cmd *cobra.Command, args []string) error { Title("Enter closing reason:").WithTheme(huh.ThemeBase()).Run(); err != nil { return fmt.Errorf("error getting close reason: %w", err) } + if closeReason == "" { + return fmt.Errorf("closing reason cannot be empty when selecting 'Other'") + } } err = app.Issues.CloseIssue(cmd.Context(), closeID, closeReason, "", "") diff --git a/pkg/web/components/assignee_form_templ.go b/pkg/web/components/assignee_form_templ.go index 06f3ea1..ae68a4f 100644 --- a/pkg/web/components/assignee_form_templ.go +++ b/pkg/web/components/assignee_form_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/base/input_templ.go b/pkg/web/components/base/input_templ.go index 9d787ce..1b68a0c 100644 --- a/pkg/web/components/base/input_templ.go +++ b/pkg/web/components/base/input_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package base //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/base/range_templ.go b/pkg/web/components/base/range_templ.go index 4ae6395..1a57ebe 100644 --- a/pkg/web/components/base/range_templ.go +++ b/pkg/web/components/base/range_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package base //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/base/select_templ.go b/pkg/web/components/base/select_templ.go index aab85ee..a7b5040 100644 --- a/pkg/web/components/base/select_templ.go +++ b/pkg/web/components/base/select_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package base //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/base/table_templ.go b/pkg/web/components/base/table_templ.go index b7544a0..7259528 100644 --- a/pkg/web/components/base/table_templ.go +++ b/pkg/web/components/base/table_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package base //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/base/textarea_templ.go b/pkg/web/components/base/textarea_templ.go index 32f9357..0d1bf07 100644 --- a/pkg/web/components/base/textarea_templ.go +++ b/pkg/web/components/base/textarea_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package base //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/close_issue_form.templ b/pkg/web/components/close_issue_form.templ index 41961df..7c6a1c2 100644 --- a/pkg/web/components/close_issue_form.templ +++ b/pkg/web/components/close_issue_form.templ @@ -7,11 +7,12 @@ type CloseIssueFormProps struct { } templ CloseIssueForm(props CloseIssueFormProps) { +
@base.Select(base.SelectProps{ Name: "close_reason", diff --git a/pkg/web/components/close_issue_form_templ.go b/pkg/web/components/close_issue_form_templ.go index e46ee65..1e2b421 100644 --- a/pkg/web/components/close_issue_form_templ.go +++ b/pkg/web/components/close_issue_form_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -35,20 +35,20 @@ func CloseIssueForm(props CloseIssueFormProps) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" hx-target=\"#close-issue-error\" hx-swap=\"innerHTML\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/web/components/comment_templ.go b/pkg/web/components/comment_templ.go index e97390e..2542d51 100644 --- a/pkg/web/components/comment_templ.go +++ b/pkg/web/components/comment_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/header_templ.go b/pkg/web/components/header_templ.go index 4a6a7fa..a4c3217 100644 --- a/pkg/web/components/header_templ.go +++ b/pkg/web/components/header_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/icons_templ.go b/pkg/web/components/icons_templ.go index c8c421c..0df923b 100644 --- a/pkg/web/components/icons_templ.go +++ b/pkg/web/components/icons_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/issue_detail_templ.go b/pkg/web/components/issue_detail_templ.go index 300533c..7f08bce 100644 --- a/pkg/web/components/issue_detail_templ.go +++ b/pkg/web/components/issue_detail_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/issue_templ.go b/pkg/web/components/issue_templ.go index 7715cb9..249ffa7 100644 --- a/pkg/web/components/issue_templ.go +++ b/pkg/web/components/issue_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/layout_templ.go b/pkg/web/components/layout_templ.go index 28d4c95..a426fce 100644 --- a/pkg/web/components/layout_templ.go +++ b/pkg/web/components/layout_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/modal_templ.go b/pkg/web/components/modal_templ.go index ac4ec26..73f131e 100644 --- a/pkg/web/components/modal_templ.go +++ b/pkg/web/components/modal_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/search_templ.go b/pkg/web/components/search_templ.go index f27707f..6fc7f33 100644 --- a/pkg/web/components/search_templ.go +++ b/pkg/web/components/search_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/sidebar_templ.go b/pkg/web/components/sidebar_templ.go index a66fd90..f26a365 100644 --- a/pkg/web/components/sidebar_templ.go +++ b/pkg/web/components/sidebar_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/components/status_templ.go b/pkg/web/components/status_templ.go index 451a387..41694c7 100644 --- a/pkg/web/components/status_templ.go +++ b/pkg/web/components/status_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/handler/issues.go b/pkg/web/handler/issues.go index 3e81016..f7bfec9 100644 --- a/pkg/web/handler/issues.go +++ b/pkg/web/handler/issues.go @@ -2,6 +2,7 @@ package handler import ( "context" + "html" "net/http" "strings" @@ -219,11 +220,18 @@ func CloseIssue(w http.ResponseWriter, r *http.Request) { return } - issue := r.Context().Value(issueKey).(*models.Issue) + issueVal := r.Context().Value(issueKey) + issue, ok := issueVal.(*models.Issue) + if !ok || issue == nil { + http.Error(w, "Issue not found in context", http.StatusInternalServerError) + return + } + closeReason := r.FormValue("close_reason") if closeReason == "" { if HTMX(r).IsHxRequest() { + w.WriteHeader(http.StatusBadRequest) HTMX(r).WriteString("
Closing reason is required
") } else { http.Error(w, "Closing reason is required", http.StatusBadRequest) @@ -233,7 +241,8 @@ func CloseIssue(w http.ResponseWriter, r *http.Request) { if err := App(r).Issues.CloseIssue(r.Context(), issue.ID, closeReason, "web", ""); err != nil { if HTMX(r).IsHxRequest() { - HTMX(r).WriteString("
Failed to close issue: " + err.Error() + "
") + w.WriteHeader(http.StatusInternalServerError) + HTMX(r).WriteString("
Failed to close issue: " + html.EscapeString(err.Error()) + "
") } else { http.Error(w, "Failed to close issue: "+err.Error(), http.StatusInternalServerError) } diff --git a/pkg/web/handler/modals.go b/pkg/web/handler/modals.go index b3fd04b..bf5101e 100644 --- a/pkg/web/handler/modals.go +++ b/pkg/web/handler/modals.go @@ -26,9 +26,9 @@ func CreateIssueFormModal(w http.ResponseWriter, r *http.Request) { } func EditIssueFormModal(w http.ResponseWriter, r *http.Request) { - issue := r.Context().Value(issueKey).(*models.Issue) - - if issue == nil { + issueVal := r.Context().Value(issueKey) + issue, ok := issueVal.(*models.Issue) + if !ok || issue == nil { http.Error(w, "Issue not found in context", http.StatusInternalServerError) return } @@ -52,9 +52,9 @@ func EditIssueFormModal(w http.ResponseWriter, r *http.Request) { } func AssigneeFormModal(w http.ResponseWriter, r *http.Request) { - issue := r.Context().Value(issueKey).(*models.Issue) - - if issue == nil { + issueVal := r.Context().Value(issueKey) + issue, ok := issueVal.(*models.Issue) + if !ok || issue == nil { http.Error(w, "Issue not found in context", http.StatusInternalServerError) return } @@ -74,9 +74,9 @@ func AssigneeFormModal(w http.ResponseWriter, r *http.Request) { } func CloseIssueFormModal(w http.ResponseWriter, r *http.Request) { - issue := r.Context().Value(issueKey).(*models.Issue) - - if issue == nil { + issueVal := r.Context().Value(issueKey) + issue, ok := issueVal.(*models.Issue) + if !ok || issue == nil { http.Error(w, "Issue not found in context", http.StatusInternalServerError) return } diff --git a/pkg/web/routes/dashboard_templ.go b/pkg/web/routes/dashboard_templ.go index 34ad856..6995da7 100644 --- a/pkg/web/routes/dashboard_templ.go +++ b/pkg/web/routes/dashboard_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package routes //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/routes/issue_detail_templ.go b/pkg/web/routes/issue_detail_templ.go index 4752600..9eb6c60 100644 --- a/pkg/web/routes/issue_detail_templ.go +++ b/pkg/web/routes/issue_detail_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package routes //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/pkg/web/routes/layout_templ.go b/pkg/web/routes/layout_templ.go index 6211e01..55d5c84 100644 --- a/pkg/web/routes/layout_templ.go +++ b/pkg/web/routes/layout_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.977 +// templ: version: v0.3.1001 package routes //lint:file-ignore SA4006 This context is only used if a nested component is present.