Skip to content

Push settings per kind

Issue #192, label ready (owner, 2026-11-14). Before it, Web Push was only on or off per device. Built before the guild chat (#169), which uses its switches; both go into the next release.

  • [E] Every push kind of today can be switched on and off on its own. The guild chat adds two kinds: guild events and guild chat messages (owner, 2026-11-14).

  • [E] Defaults: every kind is on, guild chat messages included (owner, 2026-11-14). Existing players keep every push they got before.

  • [E] The switches belong to the account and apply to all of its devices; turning push on or off per device stays as it is (owner, 2026-11-14).

  • [E] The pull request proposes the kinds, taken from the code, with their German names; the owner confirms the list before the merge (owner, 2026-11-14).

  • [E] The list of kinds with these German names, from every place that sends a push today (queuePush and addReport on main before #192; proposed in the pull request, confirmed by the owner, 2026-11-14):

    Kind (code) Name in the options Sent by
    buildings Gebäude fertig a building order is finished (build, a new device)
    research Forschung abgeschlossen the research is finished (research, a new device)
    shipyard Auftrag der Schiffsschmiede abgeschlossen the shipyard queue is finished (order, a new device)
    fleet Eigene Flotten: Ankunft, Bericht und Rückkehr an own fleet: the report at the target (Sturmangriff, Auspex, Versorgungsflug, Landnahme, Verlegung, Bergung), „Flotte kehrt um“, the return home with or without a report
    attacked Sturmangriff auf deine Planeten „Feindkontakt!“, the defender’s battle report
    spied Auspex-Aktivität bei deinen Planeten the defender’s „Auspex-Aktivität“
    delivery Lieferung eines anderen Spielers „Lieferung von …“, a transport of another player
    holds Wachen every report of a hold to its host (launch, arrival) and to its owner (no longer allowed, sent away), since #440 (243b, 283a); the vacation report stays under fleet
    announcement Servernachrichten a server announcement of the admin
    news Neue Version the update message of a new version
    guild-events Gildenereignisse an event of the guild chat (joining, leaving, removal, a new rank, an attack at its launch), to every member with „Chat lesen“ but the member it is about and the one who caused it; „Gildenereignis“ (#169)
    guild-chat Nachrichten im Gilden-Chat a message in the guild chat, to every other member with „Chat lesen“; „Neue Nachricht im Gilden-Chat“ (#169)

    Before #192 the four report kinds were one kind „messages“; the split follows the examples of the issue (an attack, news, a server announcement). The view a push opens stays as before (fleet for the return, „Nachrichten“ for every report).

  • [E] A change saves at once on each click („Gespeichert.“), like the production share; no button „Speichern“ (owner, 2026-11-14).

  • [E] The kinds „Gildenereignisse“ and „Nachrichten im Gilden-Chat“ are hidden while guilds are off in the round (owner, 2026-11-15, #169 O15 b, settles O14 b of #191); the stored choice stays.

  • [E] The box is hidden on a server without Web Push (owner, 2026-11-14). The browser learns it from GET /api/account/policy (webPush) when the page loads. The device box „Browser-Benachrichtigungen“ stays as it is.

  • [V] The box „Benachrichtigungen“ sits in „Hilfe & Optionen“ above the device box, with one checkbox per kind in a group „Welche Meldungen per Push kommen“.

  • The kinds: PUSH_TOPICS in src/core/push.ts. Since #426 (owner, 2026-11-26, 193b; the coordinator’s choice b, 2026-11-27, [V]) each kind registers itself with its order, its name and, for the guild chat, guild in a file of src/core/push-topics/ (queues.ts, fleet.ts, announcements.ts, guild-chat.ts, private-messages.ts), exported as pushTopics; scripts/gen-features.ts writes push-topics/topics.gen.ts (not checked in), and push.ts derives PUSH_TOPICS (by order, 10 to 120), GUILD_PUSH_TOPICS, the type PushTopic and pushTopicLabel; a key or an order defined twice stops the start with both files named. The names were moved unchanged out of src/client/logic/push-options.ts, which renders the checkboxes and names no kind any more.
  • Saving in the browser (pushSaver, CodeRabbit on #204): a click changes the player’s choice at once and the page shows it; one save runs at a time, and when it returns the newest choice is sent, so an older answer never undoes a newer click and two quick clicks both stay. A failed save without a newer choice shows the server’s kinds again.
  • Storage: table push_off (player, kind), one row per kind that is off, so a new kind is on for everyone; and push_jobs.topic, the kind of each queued push. Migration 17 adds both (see SQLite storage). Account deletion removes the rows by the foreign key; a new round keeps them.
  • The action pushOptions (src/server/push-options.ts) takes off, a list of known kinds, and replaces the stored list; anything else is refused („Ungültig.“). The state carries me.pushOff.
  • Filter: queuePush stores the kind with each push; delivery (web-push.ts) drops a due push whose kind its player switched off, on every device. A push that is not due yet stays queued, so switching a kind on again before a building is finished still brings its push. A push without a kind (queued before the upgrade) is delivered as before.
  • Tests: src/core/push.test.ts, src/client/logic/push-options.test.ts, src/server/push-options.test.ts, the filter for every kind on and off in src/server/web-push.test.ts, the kind of every sending place in the tests of the missions, arrival.test.ts, web-push.test.ts and news.test.ts, src/server/db/upgrades/migration-17.test.ts; E2E in e2e/game.spec.ts („push kinds (#192)“: hidden on the server without Web Push; off and on by mouse and keyboard after a reload; two quick changes with a slow first save; and on a phone) and e2e/a11y.spec.ts (the options with a kind on and off). The servers under test run without Web Push, which needs an HTTPS address, so the tests that show the box answer the policy as a server with Web Push would (withWebPush in e2e/helpers.ts: the real reply with webPush: true); saving goes to the real server.