mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
Ask for detailed news outlines and keep checked severities
Outlines move to geometry version 4: the news server now follows Natural Earth's own border vertices instead of a coarse grid, and the new version is a new cache entry. A severity a reviewer set (severityBy 'label') is kept as such instead of reading as the rules'.
This commit is contained in:
1 parent
60fad38c3f
commit
ee3593cfbd
4 files changed
+21
-5
No files matched your search
@@ -600,3 +600,17 @@ test('the hotspots answer carries the window it was counted over', () => {
|
|||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('a checked severity keeps saying who set it', () => {
|
||||||
|
const page = normalizeFeedPayload({
|
||||||
|
reports: ['label', 'model', 'guess'].map((by, i) => ({
|
||||||
|
...report(`r${i}`, '2026-10-28T09:00:00Z'),
|
||||||
|
severity: 2,
|
||||||
|
severityBy: by,
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
assert.deepEqual(
|
||||||
|
page.reports.map((r) => r.severityBy),
|
||||||
|
['label', 'model', 'rules'],
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -253,7 +253,9 @@ function normalizeReport(raw) {
|
|||||||
? raw.relevance
|
? raw.relevance
|
||||||
: 'related',
|
: 'related',
|
||||||
severity: severity(raw.severity),
|
severity: severity(raw.severity),
|
||||||
severityBy: raw.severityBy === 'model' ? 'model' : 'rules',
|
severityBy: ['model', 'label'].includes(raw.severityBy)
|
||||||
|
? raw.severityBy
|
||||||
|
: 'rules',
|
||||||
claim:
|
claim:
|
||||||
raw.claim && typeof raw.claim === 'object'
|
raw.claim && typeof raw.claim === 'object'
|
||||||
? { by: text(raw.claim.by, 80) }
|
? { by: text(raw.claim.by, 80) }
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const msg = (text) => text;
|
|||||||
const MAX_BYTES = 4 * 1024 * 1024;
|
const MAX_BYTES = 4 * 1024 * 1024;
|
||||||
const BASE_PATH = '/api/news';
|
const BASE_PATH = '/api/news';
|
||||||
// The outline geometry version the client draws (disputed areas included).
|
// The outline geometry version the client draws (disputed areas included).
|
||||||
const OUTLINE_VERSION = '3';
|
const OUTLINE_VERSION = '4';
|
||||||
|
|
||||||
/** The three read routes the news layer calls, for a host's path allowlist. */
|
/** The three read routes the news layer calls, for a host's path allowlist. */
|
||||||
export const NEWS_API_PATHS = Object.freeze([
|
export const NEWS_API_PATHS = Object.freeze([
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ test('reads validated hotspots, feed and outlines from the same-origin routes',
|
|||||||
[
|
[
|
||||||
'/api/news/hotspots',
|
'/api/news/hotspots',
|
||||||
'/api/news/feed?hotspot=all&limit=60&today=1',
|
'/api/news/feed?hotspot=all&limit=60&today=1',
|
||||||
'/api/news/outline?hotspot=ua&v=3',
|
'/api/news/outline?hotspot=ua&v=4',
|
||||||
'/api/news/outline?country=SD&v=3',
|
'/api/news/outline?country=SD&v=4',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
for (const { url, init } of calls) {
|
for (const { url, init } of calls) {
|
||||||
@@ -166,7 +166,7 @@ test('the host allowlist admits the client routes and refuses anything else', ()
|
|||||||
'/api/news/air-alerts',
|
'/api/news/air-alerts',
|
||||||
'/api/news/outline?hotspot=ua',
|
'/api/news/outline?hotspot=ua',
|
||||||
'/api/news/outline?hotspot=ua&v=2',
|
'/api/news/outline?hotspot=ua&v=2',
|
||||||
'/api/news/outline?country=ukraine&v=3',
|
'/api/news/outline?country=ukraine&v=4',
|
||||||
])
|
])
|
||||||
assert.equal(allowed(path), false, path);
|
assert.equal(allowed(path), false, path);
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user