Merge pull request #1854 from PhenomRetroShare/Fix_ForumMarkAllAsRead

Fix Forum Mark All As Read.
This commit is contained in:
csoler 2020-04-14 21:22:41 +02:00 committed by GitHub
commit 05e3ab9dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1226,13 +1226,17 @@ void RsGxsForumModel::setMsgReadStatus(const QModelIndex& i,bool read_status,boo
void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,bool with_children) void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,bool with_children)
{ {
if(read_status) int newStatus = (read_status ? mPosts[i].mMsgStatus & ~static_cast<int>(GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD)
mPosts[i].mMsgStatus = 0; : mPosts[i].mMsgStatus | static_cast<int>(GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD));
else bool bChanged = (mPosts[i].mMsgStatus != newStatus);
mPosts[i].mMsgStatus = GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD; mPosts[i].mMsgStatus = newStatus;
//Remove Unprocessed and New flags
mPosts[i].mMsgStatus &= ~(GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_GUI_NEW);
if (bChanged)
{
//Don't recurs post versions as this should be done before, if no change.
uint32_t token; uint32_t token;
auto s = getPostVersions(mPosts[i].mMsgId) ; auto s = getPostVersions(mPosts[i].mMsgId) ;
if(!s.empty()) if(!s.empty())
@ -1243,6 +1247,7 @@ void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,
} }
else else
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, mPosts[i].mMsgId ), read_status); rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, mPosts[i].mMsgId ), read_status);
}
if(!with_children) if(!with_children)
return; return;