From 4ece007eb322cceddb9d572c688c3c553f66ee85 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 27 Aug 2018 10:33:08 +0200 Subject: [PATCH] fix(ChatModel): fetch contents before insert message at end --- src/components/chat/ChatModel.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/chat/ChatModel.cpp b/src/components/chat/ChatModel.cpp index ed253bc34..32f7b7079 100644 --- a/src/components/chat/ChatModel.cpp +++ b/src/components/chat/ChatModel.cpp @@ -672,13 +672,14 @@ void ChatModel::insertMessageAtEnd (const shared_ptr &mes int row = mEntries.count(); beginInsertRows(QModelIndex(), row, row); - mEntries << qMakePair( - QVariantMap{ - { "type", EntryType::MessageEntry }, - { "timestamp", QDateTime::fromMSecsSinceEpoch(message->getTime() * 1000) } - }, - static_pointer_cast(message) - ); + + QVariantMap map{ + { "type", EntryType::MessageEntry }, + { "timestamp", QDateTime::fromMSecsSinceEpoch(message->getTime() * 1000) } + }; + fillMessageEntry(map, message); + mEntries << qMakePair(map, static_pointer_cast(message)); + endInsertRows(); }