feat(social): asymmetric per-user block, in-game block control, admin lists
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 15s
CI / ui (pull_request) Successful in 51s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m19s

Make a per-user block one-directional and non-destructive: the blocker stops
receiving everything from the blocked user (chat, nudge, friend requests,
invitations) and the matchmaker never pairs them, while the blocked user
notices nothing — their sends still persist by the normal rules but are never
delivered or surfaced (born-read). A block no longer deletes the friendship
(an unblock cleanly restores it) and instant-reads any unread the blocked user
had left for the blocker.

- backend: a directional blockExists guard across chat/nudge/friends/invitations
  (store-but-hide for the blocked->blocker direction, refuse blocker->blocked);
  the matchmaker excludes a block-related pair (both directions) from auto-match;
  user_blocked/user_unblocked notifications to the blocker only (in-app only).
- ui: the opponent score card gains a block ✖️ control mirroring add-friend
  (red "Block?" confirm, mutual-hide while confirming, struck name, hidden chat
  composer when blocked); optimistic apply + event confirm + rollback for both.
- admin: the user card gains cross-linked blocks / blocked-by / friends lists.
- docs: FUNCTIONAL(+ru), ARCHITECTURE §10 + decision record, UI_DESIGN, PRERELEASE.
This commit is contained in:
Ilia Denisov
2026-06-18 11:50:34 +02:00
parent 9074417762
commit 81b9e1529e
34 changed files with 1191 additions and 109 deletions
+23
View File
@@ -193,6 +193,29 @@ test('game: the add-friend 🤝 confirms with a tap and then reads as sent', asy
await expect(add).toBeDisabled();
});
test('game: the block ✖️ confirms in red, then hides both controls and strikes the name', async ({ page }) => {
await loginLobby(page);
await page.getByRole('button', { name: /Ann/ }).click(); // active game vs Ann
await page.locator('.scoreboard').click(); // open the history -> 🤝 and ✖️ appear on Ann's card
const block = page.getByRole('button', { name: 'Block player' });
await expect(block).toBeVisible();
await block.click(); // arm: ✖️ -> a fading ✅, the score caption turns to a red "Block?"
await expect(page.locator('.sc.blockprompt')).toHaveText('Block?');
// While confirming a block the add-friend control is hidden so the two never overlap.
await expect(page.getByRole('button', { name: 'Add to friends' })).toHaveCount(0);
await block.click(); // confirm within the window
// The block applied (optimistically): both controls disappear and the name is struck.
await expect(page.getByRole('button', { name: 'Block player' })).toHaveCount(0);
await expect(page.getByRole('button', { name: 'Add to friends' })).toHaveCount(0);
await expect(page.locator('.nm.struck')).toBeVisible();
// The chat composer is hidden for a blocked opponent — only the log remains, as in a
// finished game.
await page.getByRole('button', { name: 'Chat' }).click(); // 💬 -> comms hub
await expect(page.getByRole('button', { name: 'Send' })).toHaveCount(0);
await expect(page.getByRole('button', { name: 'Nudge' })).toHaveCount(0);
});
test('game: an opponent who is already a friend shows no add-friend 🤝', async ({ page }) => {
await loginLobby(page);
await page.getByRole('button', { name: /Kaya/ }).click(); // finished game vs Kaya, a seeded friend