Conversation
The edit form submits a hidden reminder_enabled=false immediately before the checkbox's reminder_enabled=true. Gin's PostForm/GetPostForm return the first value, so the checkbox was ignored and reminders were always saved as disabled. - Read the last value of reminder_enabled in the create and update handlers - Render the 'reminders disabled' mute icon on the full subscriptions page so it matches the htmx list partial (previously only the partial showed it) - Add a regression test covering the enable/disable/absent cases
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #119 — enabling/disabling reminders while editing a subscription is now persisted correctly.
The edit form submits a hidden
reminder_enabled=falseimmediately before the checkbox'sreminder_enabled=true. Gin'sPostForm/GetPostFormreturn the first value of a repeated field, so the checkbox was always ignored and reminders were saved as disabled regardless of the toggle.Changes
internal/handlers/subscription.go—CreateSubscriptionandUpdateSubscriptionnow read the last value ofreminder_enabledviaPostFormArray, so the standard hidden-input + checkbox pattern works in every case (enable, disable, field-absent).templates/subscriptions.html— render the "reminders disabled" mute icon on the full Subscriptions page, matching the htmx list partial (previously it only appeared after an htmx refresh).internal/handlers/subscription_reminder_test.go— regression test covering enable/disable/absent cases.Test Plan
go test ./...passesCloses #119