Repository navigation
Mark stories read through a form - #1712
Merged
Merged
Conversation
**What** When a story opens, the `story` controller submits a new hidden mark read form instead of calling the JSON API. The new `read` action marks the story read, unless it's kept unread, and responds with a Turbo Stream that replaces the keep unread form. Its saved state then marks the story read and updates the unread count. The tutorial page imitates the mark read form like the others. Remove `helpers/api.ts`, the JSON `PUT /stories/:id` endpoint, and the sample story check in the `story` controller. **Why** Last step in moving story updates to server-confirmed forms. The story controllers no longer talk to the server themselves. **Notes** `form_with` without a block leaves the form open, which nested the story's other forms inside it. The mark read form passes an empty block, and a component spec guards against the nesting.
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.
What
When a story opens, the
storycontroller submits a new hidden markread form instead of calling the JSON API. The new
readaction marksthe story read, unless it's kept unread, and responds with a Turbo
Stream that replaces the keep unread form. Its saved state then marks
the story read and updates the unread count.
The tutorial page imitates the mark read form like the others.
Remove
helpers/api.ts, the JSONPUT /stories/:idendpoint, and thesample story check in the
storycontroller.Why
Last step in moving story updates to server-confirmed forms. The story
controllers no longer talk to the server themselves.
Notes
form_withwithout a block leaves the form open, which nested thestory's other forms inside it. The mark read form passes an empty
block, and a component spec guards against the nesting.