Public: anyone can read this; the crew can change it.
An archived app leaves every list and stays reachable by its link #15118
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/15072-an-archived-app-leaves-every-list-and-st → main 2 commits fork 1 thread · 1 unresolved
4 files
changed +126
−4
src/core/access_fingerprint.ts +2 −2
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * repositories `REPO_VISIBLE` lets them read, the one rule every listing and |
| 4 | 4 | * the feed share. Memory of what they were shown is only reused while this |
| 5 | 5 | * is unchanged, so being removed from a team, losing admin, a repository |
| 6 | * turning private or its owner being suspended each end it at once, with no | |
| 6 | * turning private, being archived or its owner being suspended each end it at once, with no | |
| 7 | 7 | * list of writes to remember to watch. |
| 8 | 8 | */ |
| 9 | 9 | import type { Database } from "bun:sqlite"; |
| @@ -13,7 +13,7 @@ import { REPO_VISIBLE } from "./visibility.ts"; | ||
| 13 | 13 | export function accessFingerprint(db: Database, user: User): string { |
| 14 | 14 | const row = db |
| 15 | 15 | .query<{ ids: string | null }, [string]>( |
| 16 | `SELECT group_concat(id) AS ids FROM (SELECT repo.id AS id FROM repo WHERE ${REPO_VISIBLE} ORDER BY repo.id)`, | |
| 16 | `SELECT group_concat(id) AS ids FROM (SELECT repo.id || CASE WHEN repo.archived_at IS NULL THEN '' ELSE '~' END AS id FROM repo WHERE ${REPO_VISIBLE} ORDER BY repo.id)`, | |
| 17 | 17 | ) |
| 18 | 18 | .get(user.id); |
| 19 | 19 | return `${user.isAdmin ? "a" : "m"}${user.kind}.${Bun.hash(row?.ids ?? "").toString(36)}`; |
src/feed/timeline.ts +3 −1
| @@ -80,7 +80,9 @@ export function readTimeline( | ||
| 80 | 80 | const heard = batch.filter(audienceFilter(db, viewer, batch)); |
| 81 | 81 | const repos = getReposByIds(db, heard.map((e) => e.repoId!)); |
| 82 | 82 | const own = options.show === undefined ? undefined : showFilter(db, viewer, options.show, heard, repos); |
| 83 | const kept = own === undefined ? heard : heard.filter(own); | |
| 83 | // An archived app is put away (#1838): what it did stays out of the feed until it is restored. | |
| 84 | const awake = heard.filter((e) => repos.get(e.repoId!)?.archivedAt == null); | |
| 85 | const kept = own === undefined ? awake : awake.filter(own); | |
| 84 | 86 | for (const c of eventCandidates(db, viewer, now, kept, repos)) { |
| 85 | 87 | if (chipHides(chips, c) || dismissed.has(c.id) || muted.has(c.repoId)) continue; |
| 86 | 88 | picked.push({ |
src/flow/lanes.ts +3 −1
| @@ -420,7 +420,9 @@ export function viewFor( | ||
| 420 | 420 | const r = repos.get(id); |
| 421 | 421 | readable.set( |
| 422 | 422 | id, |
| 423 | r !== undefined && canRead(db, r, viewer) ? r : undefined, | |
| 423 | // An archived app is put away: it leaves the lanes and the filter, its own link still | |
| 424 | // opens. | |
| 425 | r !== undefined && r.archivedAt === null && canRead(db, r, viewer) ? r : undefined, | |
| 424 | 426 | ); |
| 425 | 427 | } |
| 426 | 428 | return readable.get(id); |
new above
offline
Comment line is over 100 columns; rewrap.