Public: anyone can read this; the crew can change it.
/explore filters apps by 'changed this week' with a plain link chip #15123
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/15088-explore-filters-apps-by-changed-this-wee → main 4 commits fork 1 thread · 1 unresolved
3 files
changed +15
−3
docs/features/explore.md +1 −1
| @@ -51,7 +51,7 @@ What a person filters on `/explore` an agent filters with the same words. Each f | ||
| 51 | 51 | |---|---|---|---| |
| 52 | 52 | | Best / Forks / Shipped / Liked / Use / Fresh / Newest | `sort=score` `forks` `ships` `likes` `use` `fresh` `new` (`name` by hand) | `?sort=forks` | `{ sort: "forks" }` | |
| 53 | 53 | | All / Apps / People / Forges (admin) | `kind=app` `person` `forge` | `?kind=app` | `{ kind: "app" }` | |
| 54 | | Any time / Today / This week / This month | `since=1d` `7d` `30d` (`updated=` is the same; `week=1` is `7d`, and `updated`/`since` win beside it) | `?since=7d` | `{ since: "7d" }` | | |
| 54 | | Any time / Today / This week / This month | `since=1d` `7d` `30d` (`updated=` is the same; `week=1` and `fresh=7` are `7d`, any other `fresh` is ignored, and `updated`/`since` win beside it) | `?since=7d` | `{ since: "7d" }` | | |
| 55 | 55 | | Show archived | `archived=yes` | `?archived=yes` | `{ archived: "yes" }` | |
| 56 | 56 | | (owner link on a row) | `owner=name` | `?owner=name` | `{ owner: "name" }` | |
| 57 | 57 | | (type it) at least N forks by people | `forks=3` (0–1000) | `?forks=3` | `{ forks: "3" }` | |
src/actions/explore.ts +5 −2
| @@ -172,8 +172,11 @@ export function exploreLineFrom(get: (name: string) => string | null | undefined | ||
| 172 | 172 | if (key === "live") value = LIVE_WORDS[value.toLowerCase()] ?? ""; |
| 173 | 173 | if (value !== "") given.set(key, value); |
| 174 | 174 | } |
| 175 | // `week=1` is `updated:7d`; any other value, and `updated`/`since` beside it, win or are ignored. | |
| 176 | if (!given.has("updated") && (get("week") ?? "").trim() === "1") given.set("updated", "7d"); | |
| 175 | // `week=1` and `fresh=7` (#15088) are the same 7-day window; any other value is ignored, not an | |
| 176 | // error. | |
| 177 | if (!given.has("updated") && ((get("week") ?? "").trim() === "1" || (get("fresh") ?? "").trim() === "7")) { | |
| 178 | given.set("updated", "7d"); | |
| 179 | } | |
| 177 | 180 | // A parameter wins: the same key typed in `q` is dropped, not left to the reader's order. |
| 178 | 181 | const typed = cappedQuery(get("q")) |
| 179 | 182 | .split(/\s+/) |
test/explore-quick-filters.test.ts +9
| @@ -81,6 +81,15 @@ test("week=1 keeps only apps changed in under 7 days", async () => { | ||
| 81 | 81 | expect(names((await get("?kind=app&week=1")).html)).toEqual(["both", "weekonly"]); |
| 82 | 82 | }); |
| 83 | 83 | |
| 84 | test("fresh=7 is the same week; off and any other value narrow nothing (#15088)", async () => { | |
| 85 | expect(names((await get("?kind=app&fresh=7")).html)).toEqual(["both", "weekonly"]); | |
| 86 | const on = (await get("?kind=app&fresh=7")).html; | |
| 87 | expect(link(on, "This week").tag).toContain('aria-current="page"'); | |
| 88 | // The chip toggles it off: following its link leaves the week out. | |
| 89 | expect(names((await get(link(on, "Any time").href.replace("/explore", ""))).html)).toEqual(ALL); | |
| 90 | for (const v of ["", "0", "8", "week", "-7", "7d"]) expect(names((await get(`?kind=app&fresh=${v}`)).html)).toEqual(ALL); | |
| 91 | }); | |
| 92 | ||
| 84 | 93 | test("both together intersect", async () => { |
| 85 | 94 | expect(names((await get("?kind=app&live=1&week=1")).html)).toEqual(["both"]); |
| 86 | 95 | }); |
new above
offline
Duplicates the
weekline above. Merge:if (!given.has("updated") && ((get("week") ?? "").trim() === "1" || (get("fresh") ?? "").trim() === "7")) given.set("updated", "7d");. And documentfresh=7in docs/features/explore.md.