Add file & video & voice in chat Crm
This commit is contained in:
@@ -134,8 +134,12 @@ export class ConversationsService {
|
||||
chatUserId,
|
||||
wsUrl: `wss://${host}/ws?${params.toString()}`,
|
||||
messagesBaseUrl: `https://${host}`,
|
||||
uploadUrl: creds.uploadUrl,
|
||||
downloadUrl: creds.downloadUrl,
|
||||
uploadUrl:
|
||||
creds.uploadUrl.trim() ||
|
||||
`https://${host}/upload`,
|
||||
downloadUrl:
|
||||
creds.downloadUrl.trim() ||
|
||||
`https://${host}/files`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -433,9 +437,21 @@ export class ConversationsService {
|
||||
const kind = tracked?.kind === 'group' ? 'group' : tracked?.kind === 'dm' ? 'dm' : 'group';
|
||||
|
||||
const lastMsg = (row.last_message ?? row.lastMessage) as Record<string, unknown> | undefined;
|
||||
const preview = lastMsg
|
||||
const lastType = String(lastMsg?.type_content ?? lastMsg?.type ?? 'text')
|
||||
.toLowerCase()
|
||||
.trim();
|
||||
let preview = lastMsg
|
||||
? String(lastMsg.content ?? lastMsg.text ?? lastMsg.body ?? '').trim()
|
||||
: '';
|
||||
if (lastType === 'image' || lastType === 'photo' || lastType === 'img') {
|
||||
preview = 'تصویر';
|
||||
} else if (lastType === 'voice' || lastType === 'audio') {
|
||||
preview = 'وویس';
|
||||
} else if (lastType === 'video') {
|
||||
preview = 'ویدیو';
|
||||
} else if (lastType === 'file' || lastType === 'document' || lastType === 'attachment') {
|
||||
preview = 'فایل';
|
||||
}
|
||||
const lastAtRaw =
|
||||
lastMsg?.created_at ?? lastMsg?.createdAt ?? row.updated_at ?? row.updatedAt ?? null;
|
||||
const unread = Number(row.unread_count ?? row.unreadCount ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user