From 77adc82aa278f958d4b16befb44fdbfc1eb57c32 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 29 Apr 2017 17:32:23 +0200 Subject: [PATCH] Fix Missing messages when mark all as read. If message get olders versions, these ones was not marked as read. So it left unread messages on thread despite nothing appears on tree view. --- libretroshare/src/gxs/rsgxsdata.cc | 10 +++++++--- .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 14 +++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsdata.cc b/libretroshare/src/gxs/rsgxsdata.cc index 090a7b602..de1ce4024 100644 --- a/libretroshare/src/gxs/rsgxsdata.cc +++ b/libretroshare/src/gxs/rsgxsdata.cc @@ -239,17 +239,21 @@ void RsGxsMsgMetaData::clear() mMsgId.clear(); mThreadId.clear(); mParentId.clear(); - mAuthorId.clear(); mOrigMsgId.clear(); - mMsgName.clear(); - mServiceString.clear(); + mAuthorId.clear(); signSet.TlvClear(); + mMsgName.clear(); mPublishTs = 0; mMsgFlags = 0; + + mServiceString.clear(); mMsgStatus = 0; + mMsgSize = 0; mChildTs = 0; recvTS = 0; + mHash.clear(); + validated = false; } bool RsGxsMsgMetaData::serialise(void *data, uint32_t *size) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 6afa8dbdd..6402d130a 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1844,11 +1844,23 @@ void GxsForumThreadWidget::setMsgReadStatus(QList &rows, bool // LIKE THIS BELOW... //std::string grpId = (*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_GROUPID).toString().toStdString(); - RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), RsGxsMessageId(msgId)); + RsGxsGrpMsgIdPair msgPair = std::make_pair( groupId(), RsGxsMessageId(msgId) ); uint32_t token; rsGxsForums->setMessageReadStatus(token, msgPair, read); + // Look if older version exist to mark them too + QMap > >::const_iterator it = mPostVersions.find(mOrigThreadId) ; + if(it != mPostVersions.end()) + { + std::cerr << (*it).size() << " versions found " << std::endl; + for(int i=0;i<(*it).size();++i) + { + msgPair = std::make_pair( groupId(), (*it)[i].second ); + rsGxsForums->setMessageReadStatus(token, msgPair, read); + } + } + /* Add message id to ignore list for the next updateDisplay */ mIgnoredMsgId.push_back(RsGxsMessageId(msgId));