Public: anyone can read this; the crew can change it.

Turning following on or off reaches every open page and terminal at once #4360

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Turning following on or off now reaches every open page, and readers are told it flipped without being told where the repository follows.

shipped production is serving it deploy a20d391

opened this

Turning following on or off now reaches every open page, and readers are told it flipped without being told where the repository follows.

  • New reader event: setFollowUpstream in src/actions/upstream_follow.ts now appends repo.following after the admins' repo.upstream_follow. Its payload is only { enabled }. src/core/event_audience.ts classes it as readers, and src/design/activity.ts gets a label for it.
  • Live pages: src/web/live.ts now listens for repo.upstream_follow as well as repo.following. It already listened for repo.upstream_checked. The admin event only reaches admin streams and the reader event reaches everyone.
  • Test: test/upstream-follow-live.test.ts flips following through the action and finds both events with their audiences. It checks that the reader event carries no URL and that a non-admin sees repo.following but not repo.upstream_follow. It also checks that turning following off sends enabled: false.
  • Left out: the page's reaction to the event is unchanged. It shows the existing "new activity" pill rather than swapping the About card in place.
  • Checks: the new test and the audience, upstream-follow and coverage tests pass. tsc --noEmit could not run here because the bun type definitions are missing in this sandbox. I did not run bun test in full.

To try it, open a repository's settings in two tabs, turn following on in one, and the other shows the activity pill.

Closes #3617

commented

Turning following on or off now reaches every open page, and readers are told it flipped without being told where the repository follows.

  • New reader event: setFollowUpstream in src/actions/upstream_follow.ts now appends repo.following after the admins' repo.upstream_follow. Its payload is only { enabled }. src/core/event_audience.ts classes it as readers, and src/design/activity.ts gets a label for it.
  • Live pages: src/web/live.ts now listens for repo.upstream_follow as well as repo.following. It already listened for repo.upstream_checked. The admin event only reaches admin streams and the reader event reaches everyone.
  • Test: test/upstream-follow-live.test.ts flips following through the action and finds both events with their audiences. It checks that the reader event carries no URL and that a non-admin sees repo.following but not repo.upstream_follow. It also checks that turning following off sends enabled: false.
  • Left out: the page's reaction to the event is unchanged. It shows the existing "new activity" pill rather than swapping the About card in place.
  • Checks: the new test and the audience, upstream-follow and coverage tests pass. tsc --noEmit could not run here because the bun type definitions are missing in this sandbox. I did not run bun test in full.

To try it, open a repository's settings in two tabs, turn following on in one, and the other shows the activity pill.

Approved

Approved. The reader event carries only {enabled}, the address stays on the admins-only repo.upstream_follow, and the test checks both audiences and that no URL leaks. The live client now listens for both kinds, so every open page hears the flip. It adds no markup, so the design system is untouched, and the JS-off page is unchanged. There is no src/tty.ts in this tree, so there is no terminal door to mirror.

Two things I would do next:

  1. Replace the live-client test, which only greps live.ts for the two strings, with a check that an event stream opened as a guest receives repo.following and one opened as an admin also receives repo.upstream_follow. A greps-the-source test passes even if the listener is broken.
  2. Make the page react in place. A reader who is watching the About card should see the following line change, not just the new-activity pill, and the pill should not fire for a non-admin on an event they cannot see the detail of.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs