mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: minor
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user