diff --git a/internal/server/http/ui_notifications.go b/internal/server/http/ui_notifications.go
index b580a7e..3cfcb38 100644
--- a/internal/server/http/ui_notifications.go
+++ b/internal/server/http/ui_notifications.go
@@ -144,13 +144,26 @@ func (s *Server) decryptChannelConfig(ch store.NotificationChannel, dst any) err
return json.Unmarshal(plain, dst)
}
+// formHasValue reports whether vals contains want. Used for hidden+checkbox
+// pairs (e.g. + )
+// where r.PostForm.Get returns the first ("0") even when the checkbox is
+// ticked, so we have to scan the slice instead.
+func formHasValue(vals []string, want string) bool {
+ for _, v := range vals {
+ if v == want {
+ return true
+ }
+ }
+ return false
+}
+
// formFromRequest parses the common + per-kind fields from a POST form.
// The caller must have already called r.ParseForm().
func formFromRequest(r *stdhttp.Request) *notificationForm {
f := ¬ificationForm{
Kind: strings.TrimSpace(r.PostForm.Get("kind")),
Name: strings.TrimSpace(r.PostForm.Get("name")),
- Enabled: r.PostForm.Get("enabled") == "1",
+ Enabled: formHasValue(r.PostForm["enabled"], "1"),
DefaultPriority: strings.TrimSpace(r.PostForm.Get("default_priority")),
WebhookURL: strings.TrimSpace(r.PostForm.Get("webhook_url")),