Lead a role in several cities with the one nearest the viewing agent, in the row, the reader and the posting link

Places are ordered in tiers off the agent's gates (the any group, then the require scope, then the rest), and within a tier by the home the any group gives, since the gazetteer holds no coordinates. GET /api/roles and /api/roles/{uid} carry place_texts, lead_place and lead_url for the roles served; the gates and the dupes rule are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-10-04 08:15:26 +02:00
1 parent ac4cdb8a48
commit fb24c8e4c9
8 files changed
+277 -29

No files matched your search

+15 -7
View File
@@ -979,13 +979,20 @@
return n > 1 ? `<span class="dupes" title="Posted ${n} times">×${n}</span>` : "";
}
/* Where a role's posting is: the ad's own page once it is known
/* Where a role's own posting is: the ad's own page once it is known
(`posting_url`, found for a Jobindex role when its text is fetched), else
the link the board listed. Either way only an http(s) link. */
function linkOf(x) {
function ownLink(x) {
return safeUrl(x?.posting_url) || safeUrl(x?.original_url);
}
/* Where the row and the reader open a role: the copy of the place it leads
with, the one nearest the agent (`lead_url`, `places.Nearness`), else
its own posting. */
function linkOf(x) {
return safeUrl(x?.lead_url) || ownLink(x);
}
/* The other postings of this role, each a link to where it is posted,
labelled by host and place, as newsdesk's "Also covered by". */
function alsoPosted(r) {
@@ -1004,11 +1011,12 @@
</div>`;
}
/* The role's places in the host's order, one entry for each place text a
link opens: the copies' own links, and the role's link for its own. */
/* The role's places as the server orders them, the nearest to the agent
first, one entry for each place text a link opens: the copies' own
links, and the role's link for its own. */
function placeEntries(r) {
const seen = new Set();
const own = linkOf(r);
const own = ownLink(r);
const out = [];
for (const p of Array.isArray(r.places) ? r.places : []) {
const url = p.url ? safeUrl(p.url) : own;
@@ -1020,8 +1028,8 @@
return out;
}
/* The place line of the reader: the first place and "+N" for the others,
as the feed's row shows it. */
/* The place line of the reader: the leading place and "+N" for the
others, as the feed's row shows it. */
function placeLine(r) {
const texts = [...new Set(placeEntries(r).map((e) => e.text))];
return texts.length > 1 ? `${texts[0]} +${texts.length - 1}` : r.place || texts[0] || "";