fix: minor

This commit is contained in:
Mohamed Marrouchi
2025-01-15 19:05:28 +01:00
parent bdf1763503
commit 0b4a1085ec
10 changed files with 44 additions and 57 deletions

View File

@@ -604,6 +604,11 @@ export default abstract class BaseWebChannelHandler<
try {
const { type, data } = req.body as Web.IncomingMessage;
if (!req.session?.web?.profile?.id) {
this.logger.debug('Web Channel Handler : No session');
return null;
}
// Check if any file is provided
if (type !== 'file' || !('file' in data) || !data.file) {
this.logger.debug('Web Channel Handler : No files provided');
@@ -622,7 +627,7 @@ export default abstract class BaseWebChannelHandler<
type: data.type,
context: 'message_attachment',
createdByRef: 'Subscriber',
createdBy: req.session.web.profile?.id,
createdBy: req.session?.web?.profile?.id,
});
} catch (err) {
this.logger.error(
@@ -677,7 +682,7 @@ export default abstract class BaseWebChannelHandler<
const file = await multerUpload;
// Check if any file is provided
if (!req.file) {
if (!file) {
this.logger.debug('Web Channel Handler : No files provided');
return null;
}

View File

@@ -9,7 +9,6 @@
import { Attachment } from '@/attachment/schemas/attachment.schema';
import EventWrapper from '@/channel/lib/EventWrapper';
import { ChannelName } from '@/channel/types';
import { AttachmentPayload } from '@/chat/schemas/types/attachment';
import {
IncomingMessageType,
PayloadType,
@@ -296,17 +295,6 @@ export default class WebEventWrapper<
}
}
/**
* Return the list of recieved attachments
*
* @deprecated
* @returns Received attachments message
*/
getAttachments(): AttachmentPayload[] {
const message = this.getMessage() as any;
return 'attachment' in message ? [].concat(message.attachment) : [];
}
/**
* Return the delivered messages ids
*