~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

next: swipe back reaches Your story; with none, New story alone on iOS

Merged
Merged chadtmiller.com asked to merge into feature/hud from grain.social/grain:next/your-story-2

What changes

Swiping back reaches your own stories. Once you have stories, Your story in the strip opens them as a normal page: the first one, before everyone else's. Swiping back from the first other person's story now lands on yours, as in Instagram and grain-ios. With none, it still opens straight at New story. The strip's Your story open is "compose": true, "unless": "unviewedCount", where that row's unviewedCount is your own stories. HUD's new unless on an open query drops compose when that path holds something. The List pages rule, "an item that opens at a form is a page only of its own pager", now applies only when you really have none.

iOS: Your story with none is New story alone. If the story you tapped opens at its form, the app's StoryPager draws no stories, only that form, over the current tab. It uses HUDKit's new OpenedForm, the iOS counterpart of the web's Tree form. Nothing is drawn until the page answers fresh, so a cached last tree never shows. Cancel returns you to the tab. Share posts the story, closes the form and refreshes the tab, so the strip updates. No empty "No stories right now" page is left behind. With stories, the pager works as before.

vendor/hud is HUD ab46d11.

Why

feature/hud's previous Your story change (HUD dfee59e) left two gaps:

  • Every Your story call carried compose, so the pages rule left your own stories out of everyone else's pager. You could no longer swipe back to them.
  • The iOS app still opened Your story with none as a page under the compose sheet, so cancelling left an empty page behind.

Deciding this in the view, from data the strip already joins (joins.mine.stories), keeps every client's List rule the same. Web, HUDKit and Android all follow it without client changes. The other option, telling each client whether a page "really" opens at a form, would need the answer before the tap.

How it was checked

  • HUD: just cov at 100% lines and functions, clippy, fmt, just lint, just ios-test (including the new aScreenOpensAtTheFormMarkedOpen), just android-test (including the new withStoriesYourStoryIsTheFirstPage), and web npm run check, ssr and unit.
  • Grain: node next/check-apps.mjs and npm run check.
  • Deploy safety: with HUD ab46d11, hud_core::operator::load loads both next.grain.social's live apps and this branch's next/.

Shortcomings

  • next.grain.social's HUD (hud-next) must run HUD ab46d11 or later before this lands. An older HUD refuses the view's unless ("unknown key"), and the deploy would roll back.
Approved

This makes Your story open as the first normal page once you have stories. It does that by adding "unless": "unviewedCount" to the strip's open query, so HUD drops compose when that count is non-empty. With none, iOS draws the New story form alone through OpenedForm, and Cancel or Share closes the stories. The view change is one line, and the StoryPager logic reads correctly. Nothing is drawn until the page answers fresh. After a send, onReload closes the stories rather than re-reading the page. With stories, composes is false and the pager runs as before.

I only had the diff to go on, so I didn't run the tests. The HUD ab46d11 bump has no Rust-side changes in this diff, so I couldn't read the unless implementation here. Your note that hud-next must run ab46d11 or later before this lands is the real deploy risk. Make sure that goes out first.

Approved

The change since my approval is small. While the New story form waits for a fresh answer, StoryPage now draws Color.clear instead of nothing, so the view exists and the page loads. That fits the earlier logic, and the cached tree is still never shown. My earlier approval stands. I only read this diff and ran nothing. The deploy ordering note still applies: hud-next must run HUD ab46d11 or later before this lands.

Thanks. Two things on your notes.

unless: "unviewedCount" isn't a count. In the Your story row, unviewedCount is {"$root": "joins.mine.stories"}. That's the stories list from getStories(actor: me), and grain-serve's stories_sql returns every story from the last day, whether or not it's been viewed. getAuthors' real unviewedCount drops to 0 once you watch your own stories, but this field doesn't. So Your story keeps opening your stories after you've watched them. Checked locally with a release HUD ab46d11, a harness PDS and grain-serve:

  • Web: alice watched her own story to the end, which recorded her story_view on it. Back on Home, Your story still opened her story, not New story.
  • iOS (sim, signed in as alice.test): the same after watching.

Also checked on iOS:

  • With none: New story opens alone. A photo picked from the Library, then Share, posts it and returns to Home. The strip shows Your story ringed, with no pager and no empty page left behind.
  • With stories: Your story opens alice's. From Bob's, swiping back reaches alice's own.

The earlier iOS "opened nothing" was another test run driving the same simulator, not an app bug.

Deploy order: agreed. hud-next must run HUD ab46d11 or later before this lands, or the view's unless is refused as an unknown key.

Approved

The only change since my approval is a merge of feature/hud. It conflicted in vendor/hud/COMMIT, and the merge resolved that to 001122e. The pull's own diff is otherwise the same as before: the unless on the strip's open query, and the StoryPager form-alone path. I read it and ran nothing.

I couldn't confirm that 001122e contains HUD ab46d11, which the unless key needs. The body still names ab46d11. Please check that the vendored HUD has unless, and that hud-next runs a HUD at least that new before this lands.

Merged as f1d4ba5
Part of a stack of 2
  1. next: swipe back reaches Your story; with none, New story alone on iOS Landed as f1d4ba5
  2. main