A plain blocklist for names like @support - separate from the collectible
system, so a reservation has no owner, no price and no "bought on Fragment"
badge.
- reserved_usernames table + migration.
- Enforced in replacePeerUsernameTx (the single editable-username write point:
account.updateUsername, channels.updateUsername, @BotFather /setusername) and
in the collectible mint path; a reserved name returns USERNAME_OCCUPIED.
- admin.Service: ReserveUsername / UnreserveUsername (journalled commands) and
the ReservedUsernames listing.
- adminapi: /v1/reserved-usernames{,/reserve,/unreserve}.
- telesrv-admin panel + a "Reserved Usernames" page in the web UI (dist rebuilt).
- Postgres and in-memory store implementations; the memory registry gains an
optional reserved-name check so tests exercise the same rule.
17 lines
827 B
SQL
17 lines
827 B
SQL
-- Operator-maintained username blocklist. A name listed here cannot be taken as
|
|
-- an editable username by any peer (account.updateUsername, channels.updateUsername,
|
|
-- @BotFather /setusername, or the admin set-username actions). It is a plain
|
|
-- blocklist: no owner, no price, no Fragment collectible badge.
|
|
|
|
CREATE TABLE public.reserved_usernames (
|
|
username_lower text PRIMARY KEY CHECK (
|
|
username_lower <> '' AND username_lower = lower(username_lower)
|
|
),
|
|
username text NOT NULL,
|
|
reason text NOT NULL DEFAULT '' CHECK (octet_length(reason) <= 512),
|
|
actor text NOT NULL DEFAULT '' CHECK (octet_length(actor) <= 256),
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX reserved_usernames_created_at_idx
|
|
ON public.reserved_usernames (created_at DESC, username_lower);
|