diff --git a/app/static/roles.js b/app/static/roles.js index 7814ac4..8c597a5 100644 --- a/app/static/roles.js +++ b/app/static/roles.js @@ -903,16 +903,23 @@ return n > 1 ? `×${n}` : ""; } + /* Where a role's 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) { + return safeUrl(x?.posting_url) || safeUrl(x?.original_url); + } + /* 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) { const copies = (Array.isArray(r.copies) ? r.copies : []) - .filter((c) => safeUrl(c.original_url)); + .filter((c) => linkOf(c)); if (!copies.length) return ""; return `
This role could not be loaded: ${esc(error)}
` @@ -1502,7 +1509,7 @@ const uid = state.readingUid || state.items[state.selected]?.uid; const role = state.reading?.uid === uid ? state.reading : state.items.find((r) => r.uid === uid); - const url = safeUrl(role?.original_url); + const url = linkOf(role); if (!url) return; window.open(url, "_blank", "noopener"); markRead(uid);