feat: add NFT usernames and bot verification (#22)
Implements collectible usernames, official verification workflows, and third-party bot verification after maintainer protocol and migration review. The composite activity/moderation rating remains an admin-only read model; Telegram Stars Rating wire fields stay unset pending a dedicated official-semantics implementation. Reviewed-Head: 2796345775ea0f908fb7734601e5e1dee4b653b9 Original-Head: fa082b892fd5180c9c9bc53c81c21cf5d250a75b Co-authored-by: Egor Egorov <business.egor.sg@gmail.com>
This commit is contained in:
parent
b0fd3976f1
commit
fff8de783a
169 changed files with 55769 additions and 282 deletions
|
|
@ -99,13 +99,15 @@ WITH desired (
|
|||
EXCLUDED.about, EXCLUDED.is_bot, EXCLUDED.bot_info_version
|
||||
)
|
||||
)
|
||||
INSERT INTO peer_usernames (username_lower, peer_type, peer_id)
|
||||
SELECT lower(username), 'user', id
|
||||
INSERT INTO peer_usernames (username_lower, username, peer_type, peer_id, active, editable, sort_order)
|
||||
SELECT lower(username), username, 'user', id, true, true, 0
|
||||
FROM desired
|
||||
ON CONFLICT (peer_type, peer_id) DO UPDATE SET
|
||||
ON CONFLICT (peer_type, peer_id) WHERE editable DO UPDATE SET
|
||||
username_lower = EXCLUDED.username_lower,
|
||||
username = EXCLUDED.username,
|
||||
updated_at = now()
|
||||
WHERE peer_usernames.username_lower IS DISTINCT FROM EXCLUDED.username_lower
|
||||
WHERE (peer_usernames.username_lower, peer_usernames.username)
|
||||
IS DISTINCT FROM (EXCLUDED.username_lower, EXCLUDED.username)
|
||||
`, u.ID, u.AccessHash, u.Phone, u.FirstName, u.LastName, u.Username, u.CountryCode, u.Verified, u.Support, u.About, u.Bot, u.BotInfoVersion); err != nil {
|
||||
return fmt.Errorf("ensure official system user: %w", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue