mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
Merge pull request #1854 from PhenomRetroShare/Fix_ForumMarkAllAsRead
Fix Forum Mark All As Read.
This commit is contained in:
commit
05e3ab9dcd
@ -1226,29 +1226,34 @@ void RsGxsForumModel::setMsgReadStatus(const QModelIndex& i,bool read_status,boo
|
||||
|
||||
void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,bool with_children)
|
||||
{
|
||||
if(read_status)
|
||||
mPosts[i].mMsgStatus = 0;
|
||||
else
|
||||
mPosts[i].mMsgStatus = GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||
int newStatus = (read_status ? mPosts[i].mMsgStatus & ~static_cast<int>(GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD)
|
||||
: mPosts[i].mMsgStatus | static_cast<int>(GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD));
|
||||
bool bChanged = (mPosts[i].mMsgStatus != newStatus);
|
||||
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);
|
||||
|
||||
uint32_t token;
|
||||
if (bChanged)
|
||||
{
|
||||
//Don't recurs post versions as this should be done before, if no change.
|
||||
uint32_t token;
|
||||
auto s = getPostVersions(mPosts[i].mMsgId) ;
|
||||
|
||||
auto s = getPostVersions(mPosts[i].mMsgId) ;
|
||||
if(!s.empty())
|
||||
for(auto it(s.begin());it!=s.end();++it)
|
||||
{
|
||||
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, it->second ), read_status);
|
||||
std::cerr << "Setting version " << it->second << " of post " << mPosts[i].mMsgId << " as read." << std::endl;
|
||||
}
|
||||
else
|
||||
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, mPosts[i].mMsgId ), read_status);
|
||||
}
|
||||
|
||||
if(!s.empty())
|
||||
for(auto it(s.begin());it!=s.end();++it)
|
||||
{
|
||||
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, it->second ), read_status);
|
||||
std::cerr << "Setting version " << it->second << " of post " << mPosts[i].mMsgId << " as read." << std::endl;
|
||||
}
|
||||
else
|
||||
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, mPosts[i].mMsgId ), read_status);
|
||||
if(!with_children)
|
||||
return;
|
||||
|
||||
if(!with_children)
|
||||
return;
|
||||
|
||||
for(uint32_t j=0;j<mPosts[i].mChildren.size();++j)
|
||||
recursSetMsgReadStatus(mPosts[i].mChildren[j],read_status,with_children);
|
||||
for(uint32_t j=0;j<mPosts[i].mChildren.size();++j)
|
||||
recursSetMsgReadStatus(mPosts[i].mChildren[j],read_status,with_children);
|
||||
}
|
||||
|
||||
void RsGxsForumModel::recursUpdateReadStatusAndTimes(ForumModelIndex i,bool& has_unread_below,bool& has_read_below)
|
||||
|
Loading…
Reference in New Issue
Block a user