feat(rust): the rewards — tally, kit reward, chat and the news leg (phase 13b, protocol 10)
Four event verbs and the announce leg, per PLAN.md §29: - rust.participation.open / .collect: the plugin counts who takes part (seconds, kills or both, in a zone this run opened or the whole server) and collect files them as the run's participants, keyed by Steam id. - rust.kit.entitle: the five recipient modes (D101), rows in the new rust_perm_run_grants (D84) unioned into the permission push, one extra use of the kit per reward as site-held credits on perm.sync (D103), and the rust.kit.entitled notice deferred from phase 10 (D64). - rust.announce: one server or every server (D105). - rust.chat announce leg, speaking only on servers whose new news switch is on (D104) - a card on Admin -> Rust visibility (D106). Budgets rust.grants and rust.announcements; the kit source and four fixed-choice sources (core has no enum param type). rust_perm_run_grants carries core's idempotency key so a revert of a lost answer can find its rows. Protocol 10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -185,6 +185,31 @@ test('the clan roster audience defaults to members, and a bad one writes nothing
|
||||
}
|
||||
})
|
||||
|
||||
test('news in game chat is off by default, on or off per server, and validated whole (D104, D106)', async () => {
|
||||
const { model, written, restore } = setup({ overrides: { main: null } })
|
||||
const db = require('../model/visibility/visibility.db')
|
||||
const news = []
|
||||
db.setServerNews = async (id, on) => news.push({ id, on })
|
||||
try {
|
||||
// A row that never had the column set reads as off.
|
||||
assert.deepEqual((await model.describe()).news.servers, [{ id: 'main', name: 'MAIN', enabled: true, on: false }])
|
||||
|
||||
const notBoolean = await model.update({ news: { main: 'yes' } })
|
||||
assert.equal(notBoolean.status, 400)
|
||||
const unknown = await model.update({ fleet: 'public', news: { main: true, nope: true } })
|
||||
assert.equal(unknown.status, 404)
|
||||
assert.deepEqual(news, [])
|
||||
assert.deepEqual(written.settings, [], 'the fleet change beside it was not written either')
|
||||
|
||||
const ok = await model.update({ news: { main: true } }, { id: 3 })
|
||||
assert.equal(ok.ok, true)
|
||||
assert.deepEqual(news, [{ id: 'main', on: true }])
|
||||
assert.deepEqual(ok.changed.news, { main: true })
|
||||
} finally {
|
||||
restore()
|
||||
}
|
||||
})
|
||||
|
||||
// ── The public routes ─────────────────────────────────────────────────────
|
||||
|
||||
/** A response double recording what a handler answered. */
|
||||
|
||||
Reference in New Issue
Block a user