From 987fca949969c1e762f9c8f14b383a6c0ff6b606 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 8 Nov 2017 17:51:38 +0100 Subject: [PATCH] fix(ChatRoom): mark as read correctly chat message --- src/chat/chat-room/chat-room.cpp | 7 ++++++- src/chat/chat-room/real-time-text-chat-room.cpp | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/chat/chat-room/chat-room.cpp b/src/chat/chat-room/chat-room.cpp index eeddb572b..c8b2f51a6 100644 --- a/src/chat/chat-room/chat-room.cpp +++ b/src/chat/chat-room/chat-room.cpp @@ -228,7 +228,7 @@ void ChatRoomPrivate::storeOrUpdateMessage (const shared_ptr &msg) void ChatRoomPrivate::sendMessage (const shared_ptr &msg) { L_Q(); - + msg->getPrivate()->setDirection(ChatMessage::Direction::Outgoing); /* Add to transient list */ @@ -556,6 +556,11 @@ void ChatRoom::markAsRead () { chatMessage->sendDisplayNotification(); dCore->mainDb->markChatMessagesAsRead(peerAddress); + + if (d->pendingMessage) { + d->pendingMessage->updateState(ChatMessage::State::Displayed); + d->pendingMessage->sendDisplayNotification(); + } } // ----------------------------------------------------------------------------- diff --git a/src/chat/chat-room/real-time-text-chat-room.cpp b/src/chat/chat-room/real-time-text-chat-room.cpp index 6c872b9eb..fa7acf95f 100644 --- a/src/chat/chat-room/real-time-text-chat-room.cpp +++ b/src/chat/chat-room/real-time-text-chat-room.cpp @@ -129,15 +129,6 @@ LinphoneCall *RealTimeTextChatRoom::getCall () const { return d->call; } -void RealTimeTextChatRoom::markAsRead () { - L_D(); - ChatRoom::markAsRead(); - if (d->pendingMessage) { - d->pendingMessage->updateState(ChatMessage::State::Displayed); - d->pendingMessage->sendDisplayNotification(); - } -} - // ----------------------------------------------------------------------------- void RealTimeTextChatRoom::onChatMessageReceived(const shared_ptr &msg) {}