feat(chat): add random public_id and fix users blocked route
Some checks failed
CI / test (push) Failing after 20s

- add chats.public_id random identifier with migration 0011
- expose public_id in chat API payloads
- use chat public_id in message search UI label
- fix users router order so /users/blocked no longer conflicts with /users/{user_id}
This commit is contained in:
2026-03-08 02:34:24 +03:00
parent 34edf2bae5
commit 0b4bb19425
8 changed files with 73 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ export type DeliveryStatus = "sending" | "sent" | "delivered" | "read";
export interface Chat {
id: number;
public_id: string;
type: ChatType;
title: string | null;
display_title?: string | null;

View File

@@ -138,7 +138,10 @@ export function ChatsPage() {
<p className="px-2 py-1 text-xs text-slate-400">Nothing found</p>
) : null}
<div className="tg-scrollbar max-h-[50vh] space-y-1 overflow-auto">
{searchResults.map((message) => (
{searchResults.map((message) => {
const chatMeta = chats.find((chat) => chat.id === message.chat_id);
const chatLabel = chatMeta?.public_id ?? String(message.chat_id);
return (
<button
className="block w-full rounded-lg bg-slate-800/80 px-3 py-2 text-left hover:bg-slate-700/80"
key={`search-msg-${message.id}`}
@@ -147,10 +150,11 @@ export function ChatsPage() {
setSearchOpen(false);
}}
>
<p className="mb-1 text-[11px] text-slate-400">chat #{message.chat_id} · msg #{message.id}</p>
<p className="mb-1 text-[11px] text-slate-400">chat {chatLabel} · msg #{message.id}</p>
<p className="line-clamp-2 text-sm text-slate-100">{message.text || "[media]"}</p>
</button>
))}
);
})}
</div>
</div>
</div>