feat(admin): manual account blocking (suspensions)
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 12s
CI / ui (pull_request) Successful in 45s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m10s

Operator-driven hard block, the counterpart to the soft high-rate flag: permanent or until a date, with an optional reason chosen from an editable en+ru picklist (snapshotted onto the block). A block forfeits the player's active games (opponent wins, as a resignation) and cancels their open matchmaking games. A backend gate refuses a blocked account on every /api/v1/user/* route except the block-status probe with 403 account_blocked, which threads through the gateway as the Execute result_code; the UI surfaces it as a terminal blocked screen and stops all push/poll. Temporary blocks self-expire; the operator can unblock at any time (lost games stay lost). Sessions are not revoked, so the blocked client can still reach the exempt block-status endpoint.

Backend: migration 00003 (account_suspensions + suspension_reasons) + jet regen; account suspension store; game.ForfeitAllForAccount; requireNotSuspended gate + block-status endpoint; admin console block/unblock + Reasons CRUD. Wire: fbs BlockStatus + account.block_status gateway op. UI: blocked screen, app state, transport/codec, i18n. Docs: ARCHITECTURE, FUNCTIONAL(+ru), PRERELEASE (AB).
This commit is contained in:
Ilia Denisov
2026-06-14 21:55:59 +02:00
parent 9d85090075
commit d1ba666495
48 changed files with 2206 additions and 2 deletions
+33
View File
@@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest';
import * as fb from '../gen/fbs/scrabblefb';
import { BLANK_INDEX, setAlphabet } from './alphabet';
import {
decodeBlockStatus,
decodeDraftView,
decodeEvent,
decodeFriendList,
@@ -37,6 +38,38 @@ describe('codec', () => {
expect(decodeDraftView(b.asUint8Array())).toBe('{"x":1}');
});
it('decodes a temporary BlockStatus with reason', () => {
const b = new Builder(64);
const until = b.createString('2026-07-01T12:00:00Z');
const reason = b.createString('Спам');
fb.BlockStatus.startBlockStatus(b);
fb.BlockStatus.addBlocked(b, true);
fb.BlockStatus.addPermanent(b, false);
fb.BlockStatus.addUntil(b, until);
fb.BlockStatus.addReason(b, reason);
b.finish(fb.BlockStatus.endBlockStatus(b));
expect(decodeBlockStatus(b.asUint8Array())).toEqual({
blocked: true,
permanent: false,
until: '2026-07-01T12:00:00Z',
reason: 'Спам',
});
});
it('decodes a permanent BlockStatus with empty until/reason', () => {
const b = new Builder(32);
fb.BlockStatus.startBlockStatus(b);
fb.BlockStatus.addBlocked(b, true);
fb.BlockStatus.addPermanent(b, true);
b.finish(fb.BlockStatus.endBlockStatus(b));
expect(decodeBlockStatus(b.asUint8Array())).toEqual({
blocked: true,
permanent: true,
until: '',
reason: '',
});
});
it('encodes a SubmitPlayRequest with alphabet indices', () => {
setAlphabet('scrabble_en', [
{ index: 0, letter: 'a', value: 1 },