Skip to content

Commit d64eaad

Browse files
committed
Merge commit '698ee4dc791847c256ce756b11fd84f776601226' into DIAL-42-implement-test-your-bot
2 parents 63875ed + 698ee4d commit d64eaad

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

server/src/channels/web.channel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SOCKET_EVENTS } from '@/constants'
1+
import { SOCKET_EVENTS, TEST_YOUR_BOT_CHANNEL } from '@/constants'
22
import { ConversationLiveChatService } from '@/services/conversation-live-chat.service'
33
import { MessageService } from '@/services/message.service'
44
import { logger } from '@/utils/logger'
@@ -26,7 +26,7 @@ export class WebChannel extends BaseChannel {
2626
this.credentials = credentials
2727
}
2828

29-
async prepareMessage(req: Request, res: Response) {}
29+
async prepareMessage(req: Request, res: Response) { }
3030

3131
public async sendMessageToUser({
3232
userId,
@@ -59,7 +59,7 @@ export class WebChannel extends BaseChannel {
5959
userId,
6060
this.contactId,
6161
)
62-
if (convExisted && type === 'message') {
62+
if (convExisted && type === 'message' && !this.contactId.includes(TEST_YOUR_BOT_CHANNEL)) {
6363
await this.messageService.createMessage({
6464
conversationId: convExisted.userId,
6565
from: 'bot',

server/src/services/socket.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class SocketService {
1515
private readonly chanelService: ChannelService,
1616
private readonly conversationLiveChatService: ConversationLiveChatService,
1717
private readonly messageService: MessageService,
18-
) {}
18+
) { }
1919
public handleSocketEvents(socket: Socket) {
2020
socket.on(SOCKET_EVENTS.MESSAGE, (data) => {
2121
this.handleIncomingMessage(socket, data)
@@ -50,7 +50,7 @@ export class SocketService {
5050
const { id, contactName, channelType, credentials } = expectedChannel
5151

5252
// save conversation and conversation message
53-
if (!type || isTest) {
53+
if (message || !type || !isTest) {
5454
let convExisted =
5555
await this.conversationLiveChatService.getConversation(
5656
userId,

0 commit comments

Comments
 (0)