feat(app,learn,todo): the operator's "This instance" card, screen and badge (ADR 0021, step 1)

Whoever operates the instance approves, refuses and suspends accounts
and names other operators in the app (D21 to D24, D34):

- halkyon_app: InstanceOperatorRepository on
  ServerpodInstanceOperatorGateway (the module's instanceOperator
  endpoint; refusals as OperatorFailed: notFound, isOperator,
  lastOperator, notAllowed for 401 and 403, failed), in AppDependencies.
  OperatingCubit counts the accounts that wait: asked as the person's
  app opens, after every change, and every 5 minutes only while they
  operate the instance, so nobody else's app keeps asking.
  InstanceOperatorCard (or its tiles) and WaitingAccountsBadge show
  nothing at all for anyone else. InstanceOperatorScreen, laid out as
  Settings: the accounts that wait, each showing its four words to read
  out before Approve (D33), Refuse for new ones after asking; who
  operates, Take back after asking, the last always kept; Name an
  operator by handle; Find an account by the start of its handle, with
  Suspend after asking and Name as operator. English and German texts
  ("Admin" as the role word in German).
- Learn: the card right after the Sync card in Settings, which the
  cogs' count leads to as their dot leads to Sync; the count on the
  Settings cogs of Home and Profile.
- Todo: the tiles in the account sheet and the count on its button.
  Todo's server is a member, whose `operating()` is always null, so
  nothing shows there until it holds the register.

Tests: the gateway's mapping, the repository, both cubits with their
denials, the card, the badge and the screen; Learn's Settings shows the
card and the count to an operator and neither to anyone else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-25 15:55:28 +01:00
commit 31b9c17850
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -176,6 +176,8 @@ Dependencies testDependencies({
AccountKeyStore? accountKeys,
// On the same `authGateway`; none offers SimpleLogin unless given.
FakeSimpleLoginGateway? simpleLoginGateway,
// Nobody operates the instance unless a test says so.
InstanceOperatorGateway? operatorGateway,
}) {
final device = deviceDictionaries ?? noDeviceDictionaries();
final auth = authGateway ?? FakeAuthGateway();
@ -203,6 +205,9 @@ Dependencies testDependencies({
callbackScheme: 'app.halkyon.learn',
loopbackPort: 43823,
),
instanceOperators: InstanceOperatorRepository(
operatorGateway ?? FakeInstanceOperatorGateway(),
),
sourceCodeUrl:
sourceCodeUrl ?? () async => 'https://example.org/halkyon-learn',
dictionaries: DictionaryRepository(