mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 23:45:49 -04:00
Merge pull request #828 from csoler/v0.6-EditPosts
fixed count of unread/new posts by not counting older versions
This commit is contained in:
commit
ef59a604d2
1 changed files with 9 additions and 0 deletions
|
@ -1576,11 +1576,20 @@ bool RsGxsDataAccess::getGroupStatistic(GroupStatisticRequest *req)
|
||||||
req->mGroupStatistic.mNumChildMsgsNew = 0;
|
req->mGroupStatistic.mNumChildMsgsNew = 0;
|
||||||
req->mGroupStatistic.mNumChildMsgsUnread = 0;
|
req->mGroupStatistic.mNumChildMsgsUnread = 0;
|
||||||
|
|
||||||
|
std::set<RsGxsMessageId> obsolete_msgs ; // stored message ids that are referred to as older versions of an existing message
|
||||||
|
|
||||||
|
for(uint32_t i = 0; i < msgMetaV.size(); ++i)
|
||||||
|
if(!msgMetaV[i]->mOrigMsgId.isNull() && msgMetaV[i]->mOrigMsgId!=msgMetaV[i]->mMsgId)
|
||||||
|
obsolete_msgs.insert(msgMetaV[i]->mOrigMsgId);
|
||||||
|
|
||||||
for(uint32_t i = 0; i < msgMetaV.size(); ++i)
|
for(uint32_t i = 0; i < msgMetaV.size(); ++i)
|
||||||
{
|
{
|
||||||
RsGxsMsgMetaData* m = msgMetaV[i];
|
RsGxsMsgMetaData* m = msgMetaV[i];
|
||||||
req->mGroupStatistic.mTotalSizeOfMsgs += m->mMsgSize + m->serial_size();
|
req->mGroupStatistic.mTotalSizeOfMsgs += m->mMsgSize + m->serial_size();
|
||||||
|
|
||||||
|
if(obsolete_msgs.find(m->mMsgId) != obsolete_msgs.end()) // skip obsolete messages.
|
||||||
|
continue;
|
||||||
|
|
||||||
if (IS_MSG_NEW(m->mMsgStatus))
|
if (IS_MSG_NEW(m->mMsgStatus))
|
||||||
{
|
{
|
||||||
if (m->mParentId.isNull())
|
if (m->mParentId.isNull())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue