Tag a company All roles to read its big boards with the agents' wide reach; favourite scores only

Migration 21 adds companies.all_roles, tags every favourite of any agent and each company whose board had params {"reach": "all"} (logged per board, the param removed). reach.plan reads a tagged company's boards with the union of the enabled agents' require reach and the base reach; favourite no longer widens the fetch. POST /api/companies/{key}/all-roles sets it and queues a pull when on. The Companies list, the reader and the company strip draw the toggle beside the affinity buttons, the list filters on it, and the board's reach editor drops its All roles option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 10:44:41 +02:00
1 parent 8d9a059e24
commit 5d5b7e7d3f
20 files changed
+422 -124

No files matched your search

+50 -1
View File
@@ -16,7 +16,8 @@
* Beside `api` on `window`, the few helpers more than one page script uses:
* `count`, `cell`, `debounce`, `safeUrl`, and the company list with its
* affinity control (`loadCompanies`, `companies`, `affinityControl`,
* `setAffinity`). One copy each, since two copies of a helper is one of them
* `setAffinity`) and the All roles tag beside it (`allRolesControl`). One
* copy each, since two copies of a helper is one of them
* being fixed.
*
* Affinity is per search agent. The three company helpers take the agent's
@@ -183,7 +184,55 @@
if (onChange) await onChange(updated);
}
/* The All roles tag, one more toggle in the affinity buttons' fragment
beside them, in a group of its own since it is global rather than an
agent's stance: every board of the company is read with the agents'
wide reach, Europe today, rather than their places (app/jobs/reach.py). On queues a pull on the server, as the other
reopening switches do; off asks nothing, since no role closes until the
next pull reads the board with its filter again. `onChange` runs after
the server accepted it, with the company it answered. */
function allRolesControl(companyKey, current, onChange) {
const span = document.createElement("span");
span.className = "affinity";
span.setAttribute("role", "group");
span.setAttribute("aria-label", "Company tag");
const button = document.createElement("button");
button.type = "button";
button.dataset.value = "all";
button.textContent = "All";
button.title = current
? "All roles within the agents' wide reach (Europe), not only their places. Turning it "
+ "off asks nothing first: no role closes until the next pull reads the board again."
: "All roles: read this company's boards for all roles within the agents' wide reach "
+ "(Europe), not only their places. Turning it on queues a pull.";
button.setAttribute("aria-label", "All roles");
button.setAttribute("aria-pressed", String(Boolean(current)));
button.addEventListener("click", () => setAllRoles(companyKey, !current, onChange));
span.appendChild(button);
return span;
}
async function setAllRoles(companyKey, on, onChange) {
if (!companyKey) return;
let updated;
try {
updated = await api(`/api/companies/${encodeURIComponent(companyKey)}/all-roles`, {
method: "POST", body: { on },
});
} catch (err) {
return;
}
const company = companies.get(companyKey);
if (company) company.all_roles = Boolean(updated.all_roles);
window.toast.info(on
? `${updated.name}: all roles within the agents' wide reach. `
+ "Reading now, or with the pull right after."
: `${updated.name}: back to its reach from the next pull.`);
if (onChange) await onChange(updated);
}
Object.assign(window, {
api, count, cell, debounce, safeUrl, companies, loadCompanies, affinityControl, setAffinity,
allRolesControl,
});
})();