Fix: ensureChat ответ {id,user_a,user_b}, не {chat_id}

This commit is contained in:
root 2026-08-21 12:12:33 +00:00
parent 34d4292538
commit 53bf382b84

View File

@ -307,8 +307,11 @@ const UserProfileView = {
msgBtn.textContent = '⏳ Открываем…';
try {
const r = await API.ChatApi.ensureChat(this.userId);
const cid = r.chat_id || r.chat?.id;
if (!cid) throw new Error('chat not created');
const cid = r.chat_id || r.chat?.id || r.id;
if (!cid) {
console.error('[UserProfile] no chat id in response', r);
throw new Error('chat not created');
}
App.openChat(cid, this.userId, u.name);
} catch (e) {
msgBtn.className = 'btn-b err';