openvibers/openvibe.network Commits

A remote job's place says remote once (#643)

OP OpenVibers committed 6 days ago · cf5af4abd3 · 2 files, +8 −1

The home's job cards prefixed 'Remote ·' to a location that already said remote, so a card read 'Remote · remote'
(found by the 11-07 text lint across every site). A location that starts with remote is shown as it is, capitalised;
others keep 'Remote · Berlin'.

Changes

ddiff --git a/server/home/activity.js b/server/home/activity.js
iindex 6f2683cf..11230025 100644
---- a/server/home/activity.js
++++ b/server/home/activity.js
@@@ -156,7 +156,10 @@ function jobs(body) {
const f = d.facets || {};
const where = clip(f.location || d.summary || '', 48);
const board = d.provenance && d.provenance[0] && d.provenance[0].label ? clip(d.provenance[0].label, 30) : '';
-- return { title: clip(d.title, 90), url: onHost(d.canonical_url, 'openvibe.work'), where: f.remote ? (where ? `Remote · ${where}` : 'Remote') : where, board };
++ // A remote job whose location already says so ("remote", "Remote (US)") is not "Remote · remote" (11-07 text lint).
++ const saysRemote = /^\s*remote\b/i.test(where);
++ const place = f.remote ? (saysRemote ? where.replace(/^\s*remote/i, 'Remote') : where ? `Remote · ${where}` : 'Remote') : where;
++ return { title: clip(d.title, 90), url: onHost(d.canonical_url, 'openvibe.work'), where: place, board };
})
.slice(0, 4);
}
ddiff --git a/test/home-front-door.test.js b/test/home-front-door.test.js
iindex 7c540fe8..2ead547e 100644
---- a/test/home-front-door.test.js
++++ b/test/home-front-door.test.js
@@@ -49,6 +49,10 @@ assert.deepStrictEqual(recs.map((r) => r.url), ['https://openvibe.video/v/9', 'h
assert.strictEqual(recs[0].length, '1h 6m');
assert.strictEqual(recs[1].thumb, null, 'a thumbnail only from openvibe.media');
assert.strictEqual(activity.runtime(1805), '30 min');
++// A remote job's place: "Remote · Berlin", but never "Remote · remote" (11-07).
++const remoteJob = (location, remote) => ({ visibility: 'public', title: 'Nurse', canonical_url: 'https://openvibe.work/jobs/1', facets: { location, remote } });
++assert.deepStrictEqual(activity.jobs({ results: [remoteJob('remote', true), remoteJob('Remote (US)', true), remoteJob('Berlin', true), remoteJob('Berlin', false), remoteJob('', true)] }).map((j) => j.where),
++ ['Remote', 'Remote (US)', 'Remote · Berlin', 'Berlin'], 'the place says remote once');
// The front door features no adult items and repeats no AI words about a person's looks.
const flagged = activity.publicPastes({ pastes: [