removeServerUser

tcmts.cli.sync.removeServerUser · #r4lzu42s · term · runs anywhere

Remove a contributor: their token stops working. Whether there was one.

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { serverUsers, USERS_SETTING } from "#codebase/tcmts/cli/sync";

export function removeServerUser(cb: Codebase, handle: string): boolean {
  const h = handle.replace(/^@/, "");
  const users = serverUsers(cb);
  const left = users.filter((u) => u.handle !== h);
  cb.store.setSetting(USERS_SETTING, JSON.stringify(left));
  return left.length < users.length;
}

uses

used by