We need to keep the focus in place when submitting the form. We are using a data-turbo-permanent for that. We were rendering the error form with a turbo stream. The problem was that turbo streams ignore permanent elements as per this https://github.com/hotwired/turbo/pull/688, so the system wasn't updating the input field as expected.
Handling this as the stimulus level will also help with managing additional error states (such as the one we need for confirmations).
* main: (21 commits)
Migration to migrate URLs after renaming bubbles => cards
Remove migration
Restore bubbles.css since some styles are used
Fix issues with styling card__ components
Remove bubbles.css
Fix renames that the scripts missed
Reorganize templates to remove cards/cards redundancy
Rename bubbles => cards
Safari sure loves outlines
Use a number field, and improve focus styles
Fix boosting via number input
Embed additional video formats
Fix that notifications weren't marked as read
Fix tray item position
Update House to bring patch for history restoration error
Tighten up
Restore additional missing routes removed in c0f3ff46d7
Retore route removed in c0f3ff46d7
Fix visual regression in popup menus
Perma cards should not always be 100% width
...
This introduces a more dynamic system of activity scoring, to improve
the way bubbles "bubble up" due to their activity. There are a few
different parts we can tune here, and it's likely we'll need to make
adjustments once we get a feel for how this works in practice.
The basic idea here is:
- We assign points for certain types of event that happen on a bubble. A
boost gets 1 point, a comment gets 10 points, and so on.
- These points decay over time, at a rate of 50% per day. So old
activity is worth much less than new activity. Bubbles should rise up
quickly when acted upon, bit will float back down if left idle.
- Some comments can score higher than others: the first comment from
each person on a bubble is worth more (20) because it signals that
more people are getting involved; and comments that follow a comment
by a different author are also worth more (15) because that signals
there's ongoing conversation between people, not just a series of
notes being left by one individual.
In terms of implementation, we persist the score on the bubble
whenever it changes, but we handle the decay on the client side. That
allows us to cache the bubble representation without having to
continually change it while its activity decays.
We also keep a separate `activity_score_order` attribute on the model.
This can be used to sort the bubbles in order of "most active", without
having to think about the decay.
Otherwise the text will get out of date. For example, a new notification
will say "Less than a minute ago", which is not true for very long if
the page isn't refreshed.