Split the All tag into two company overrides: All countries and All roles (WP L)

Fetching has two filters, and a company now overrides each on its own.
All countries (companies.all_countries) is the old All roles tag: its big
boards are read with the agents' wide reach. All roles (companies.all_roles,
new meaning) drops the agents' fetch terms and any later role filter.

- Migration 24 copies the old tag to all_countries and keeps all_roles for
  those companies, and moves a board's {"terms": false} to its company.
- The runner no longer reads {"terms": false}; the plan leaves the terms out
  for a company set to All roles.
- POST /api/companies/{key}/all-countries and /all-roles, each queueing a
  pull when turned on; CompanyOut carries both.
- Two toggles replace All on the Companies row, the reader and the Roles
  strip; the reach line states countries and role types in plain words;
  the filter select gets both options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 12:50:45 +02:00
1 parent 795ca3628c
commit e52857dea5
23 files changed
+602 -215

No files matched your search

+23 -15
View File
@@ -5,8 +5,8 @@
* joined with each company's board subscription — its id and whether it is
* on — so nothing here fetches `/api/sources` as well. The affinity buttons
* are `affinityControl`, the same ones the Roles tab and the read page draw,
* and beside them `allRolesControl`, the All roles tag, which is global and
* drawn with or without an agent.
* and beside them `overridesControl`, the two fetch overrides All countries
* and All roles, which are global and drawn with or without an agent.
*
* Liked and hidden are per search agent, so the `#c-agent` select above the
* list says whose the list shows and whose the buttons set. It opens on the
@@ -20,18 +20,20 @@
* `/api/companies/{key}/board`, which reads the board once before keeping
* it; Detach stops reading it and keeps the company.
*
* A row with a board says what a pull asks it for ("reads DK, SE · agents",
* `reach` from app/jobs/reach.py), and its editor has a second line that
* sets the board's own reach: the agents', or its own countries and remote,
* posted to `/api/sources/{id}/reach`. All roles within the agents' wide
* reach (Europe) is the company's All roles tag instead, which the board's
* own countries win over.
* A row with a board says what a pull asks it for, countries first and role
* types second ("reads follows agents: DK, SE, remote · all roles", `reach`
* from app/jobs/reach.py), so the row shows whether the company follows the
* agents' filters or overrides them. Its editor has a second line that sets
* the board's own reach: the agents', or its own countries and remote,
* posted to `/api/sources/{id}/reach`. The wide reach (Europe) and no role
* narrowing are the company's two overrides instead, and the board's own
* countries win over All countries.
*/
(function () {
"use strict";
const {
api, count, debounce, safeUrl, companies, loadCompanies, affinityControl, allRolesControl,
api, count, debounce, safeUrl, companies, loadCompanies, affinityControl, overridesControl,
} = window;
const $ = (sel, root = document) => root.querySelector(sel);
@@ -212,8 +214,8 @@
}
/** The open row's reach editor, for a row with a board: the agents' reach
or the board's own countries and remote. The wide reach is the
company's All roles tag, which the editor points to. */
or the board's own countries and remote. The editor points to the
company's two overrides, which are set beside the stars. */
function reachEditor(company, rerender) {
if (company.subscription_id == null) return null;
const own = company.reach_params || {};
@@ -244,9 +246,14 @@
shown();
const note = document.createElement("span");
note.className = "muted small";
note.textContent = company.all_roles
? "The All roles tag is on; a reach set here wins over it."
: "All roles within the agents' wide reach (Europe): the All tag beside the stars.";
note.textContent = [
company.all_countries
? "All countries is on; countries set here win over it."
: "All countries, beside the stars, reads the agents' wide reach (Europe).",
company.all_roles
? "All roles is on: no fetch terms."
: "All roles drops the agents' fetch terms.",
].join(" ");
form.append(mode, codes, remote, save, note);
form.addEventListener("submit", async (event) => {
event.preventDefault();
@@ -309,6 +316,7 @@
case "favourite": return company.affinity === 2;
case "liked": return company.affinity === 1;
case "hidden": return company.affinity === -1;
case "all_countries": return company.all_countries === true;
case "all_roles": return company.all_roles === true;
case "on": return company.on === true;
case "off": return company.on === false;
@@ -343,7 +351,7 @@
if (agent != null) {
row.appendChild(affinityControl(company.key, company.affinity, async () => render(), agent));
}
row.appendChild(allRolesControl(company.key, company.all_roles, async () => {
row.appendChild(overridesControl(company.key, company, async () => {
await loadCompanies(agentId());
render();
}));