add video
This commit is contained in:
@@ -479,6 +479,8 @@ export class AdminUserInsightsService {
|
||||
}
|
||||
if (type === 'IMAGE') return '[Изображение]';
|
||||
if (type === 'AUDIO' || type === 'VOICE') return '[Аудио]';
|
||||
if (type === 'VIDEO') return '[Видео]';
|
||||
if (type === 'VIDEO_NOTE') return '[Кружок]';
|
||||
if (type === 'FILE') return '[Файл]';
|
||||
if (type === 'POLL') return '[Опрос]';
|
||||
if (type === 'SYSTEM') return '[Системное сообщение]';
|
||||
|
||||
@@ -468,7 +468,7 @@ export class ChatService {
|
||||
if (room.type === 'E2E' && type === 'POLL') {
|
||||
throw new BadRequestException('Опросы недоступны в секретном E2E чате');
|
||||
}
|
||||
const allowedTypes = new Set(['TEXT', 'IMAGE', 'AUDIO', 'VOICE', 'FILE', 'EMOJI', 'POLL']);
|
||||
const allowedTypes = new Set(['TEXT', 'IMAGE', 'AUDIO', 'VOICE', 'VIDEO', 'VIDEO_NOTE', 'FILE', 'EMOJI', 'POLL']);
|
||||
if (!allowedTypes.has(type)) {
|
||||
throw new BadRequestException('Неподдерживаемый тип сообщения');
|
||||
}
|
||||
@@ -480,13 +480,13 @@ export class ChatService {
|
||||
if (poll.options.length < 2) {
|
||||
throw new BadRequestException('В опросе должно быть минимум 2 варианта');
|
||||
}
|
||||
} else if (type !== 'IMAGE' && type !== 'AUDIO' && type !== 'VOICE' && type !== 'FILE') {
|
||||
} else if (type !== 'IMAGE' && type !== 'AUDIO' && type !== 'VOICE' && type !== 'VIDEO' && type !== 'VIDEO_NOTE' && type !== 'FILE') {
|
||||
if (!content?.trim()) {
|
||||
throw new BadRequestException('Сообщение не может быть пустым');
|
||||
}
|
||||
}
|
||||
|
||||
if ((type === 'IMAGE' || type === 'AUDIO' || type === 'VOICE' || type === 'FILE') && !storageKey) {
|
||||
if ((type === 'IMAGE' || type === 'AUDIO' || type === 'VOICE' || type === 'VIDEO' || type === 'VIDEO_NOTE' || type === 'FILE') && !storageKey) {
|
||||
throw new BadRequestException('Не указан файл для отправки');
|
||||
}
|
||||
|
||||
@@ -1048,11 +1048,15 @@ export class ChatService {
|
||||
? '🎤 Голосовое'
|
||||
: message.type === 'AUDIO'
|
||||
? '🎵 Аудио'
|
||||
: message.type === 'FILE'
|
||||
? '📄 Файл'
|
||||
: message.type === 'IMAGE'
|
||||
? '📷 Фото'
|
||||
: '📎 Медиа';
|
||||
: message.type === 'VIDEO'
|
||||
? '🎬 Видео'
|
||||
: message.type === 'VIDEO_NOTE'
|
||||
? '⭕ Кружок'
|
||||
: message.type === 'FILE'
|
||||
? '📄 Файл'
|
||||
: message.type === 'IMAGE'
|
||||
? '📷 Фото'
|
||||
: '📎 Медиа';
|
||||
|
||||
for (const member of room.members) {
|
||||
if (member.userId === senderId) continue;
|
||||
|
||||
@@ -57,7 +57,7 @@ const MIME_ALIASES: Record<string, string> = {
|
||||
'application/vnd.android.package-archive': 'application/vnd.android.package-archive'
|
||||
};
|
||||
|
||||
export type ChatAttachmentKind = 'IMAGE' | 'AUDIO' | 'VOICE' | 'FILE';
|
||||
export type ChatAttachmentKind = 'IMAGE' | 'AUDIO' | 'VOICE' | 'VIDEO' | 'VIDEO_NOTE' | 'FILE';
|
||||
|
||||
export function normalizeChatContentType(contentType?: string | null, fileName?: string | null) {
|
||||
const raw = (contentType ?? '').trim().toLowerCase();
|
||||
@@ -181,10 +181,11 @@ export function contentTypeForStorageKey(storageKey: string) {
|
||||
return 'application/octet-stream';
|
||||
}
|
||||
|
||||
export function inferChatMessageType(contentType: string, options?: { voice?: boolean }): ChatAttachmentKind {
|
||||
export function inferChatMessageType(contentType: string, options?: { voice?: boolean; videoNote?: boolean }): ChatAttachmentKind {
|
||||
const normalized = normalizeChatContentType(contentType);
|
||||
if (options?.videoNote && normalized.startsWith('video/')) return 'VIDEO_NOTE';
|
||||
if (normalized.startsWith('image/')) return 'IMAGE';
|
||||
if (normalized.startsWith('video/')) return 'FILE';
|
||||
if (normalized.startsWith('video/')) return 'VIDEO';
|
||||
if (normalized.startsWith('audio/')) {
|
||||
return options?.voice ? 'VOICE' : 'AUDIO';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user