Merge remote-tracking branch 'origin/main' into LPM-48

This commit is contained in:
Robin Olsen
2026-03-08 10:58:24 +01:00
31 changed files with 527 additions and 228 deletions

View File

@@ -36,9 +36,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
}
@@ -76,9 +76,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
}
@@ -126,3 +126,29 @@ func DeleteIssueConfirmModal(w http.ResponseWriter, r *http.Request) {
confirmModal.Render(r.Context(), w)
}
func CloseIssueFormModal(w http.ResponseWriter, r *http.Request) {
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
}
if issue.Status == models.StatusClosed {
http.Error(w, "Issue is already closed", http.StatusBadRequest)
return
}
modalContent := components.CloseIssueForm(components.CloseIssueFormProps{
PostAction: "/issues/" + issue.ID + "/close",
})
modal := components.Modal(components.ModalProps{
ID: "close-issue-modal",
Title: "Close Issue",
Content: modalContent,
Open: true,
})
modal.Render(r.Context(), w)
}