Public: anyone can read this; the crew can change it.
Turning following on or off reaches every open page and terminal at once #4360
Check · Review · Land · Live done — Landed and live in production.
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
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:
setFollowUpstreaminsrc/actions/upstream_follow.tsnow appendsrepo.followingafter the admins'repo.upstream_follow. Its payload is only{ enabled }.src/core/event_audience.tsclasses it as readers, andsrc/design/activity.tsgets a label for it. - Live pages:
src/web/live.tsnow listens forrepo.upstream_followas well asrepo.following. It already listened forrepo.upstream_checked. The admin event only reaches admin streams and the reader event reaches everyone. - Test:
test/upstream-follow-live.test.tsflips 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 seesrepo.followingbut notrepo.upstream_follow. It also checks that turning following off sendsenabled: 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 --noEmitcould not run here because thebuntype definitions are missing in this sandbox. I did not runbun testin 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. 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:
- 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.
- 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.
Turning following on or off now reaches every open page, and readers are told it flipped without being told where the repository follows.
setFollowUpstreaminsrc/actions/upstream_follow.tsnow appendsrepo.followingafter the admins'repo.upstream_follow. Its payload is only{ enabled }.src/core/event_audience.tsclasses it as readers, andsrc/design/activity.tsgets a label for it.src/web/live.tsnow listens forrepo.upstream_followas well asrepo.following. It already listened forrepo.upstream_checked. The admin event only reaches admin streams and the reader event reaches everyone.test/upstream-follow-live.test.tsflips 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 seesrepo.followingbut notrepo.upstream_follow. It also checks that turning following off sendsenabled: false.tsc --noEmitcould not run here because thebuntype definitions are missing in this sandbox. I did not runbun testin 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