Skip to content

Commit ec2fa0f

Browse files
authored
Merge pull request #12 from PerfectFit-project/330-mark-message-read
message is marked as read automatically upon reception
2 parents e410090 + fb47d35 commit ec2fa0f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

niceday-broker/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class MessageHandler {
9595
onIncomingMessage(message) {
9696
console.log(message);
9797
if (message.from !== this.therapistId && message.to === this.therapistId) {
98+
// we have to mark the message as read we it is received by the therapist
99+
chatSdk.markMessageAsRead(message.from, message.id);
98100
requestRasa(message.content.TEXT, message.from, message.attachmentIds, onRasaResponse);
99101
}
100102
}

niceday-broker/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe('Test niceday-broker with mocked Rasa and goaliejs', () => {
2828
Chat: jest.fn().mockImplementation(() => ({
2929
init: jest.fn(),
3030
connect: jest.fn(),
31+
markMessageAsRead: jest.fn(),
3132
subscribeToConnectionStatusChanges: jest.fn(),
3233
sendInitialPresence: jest.fn(),
3334
subscribeToIncomingMessage: (handler) => {

0 commit comments

Comments
 (0)