added menu entry to switch single post as unread, and fixed the setAllMsgAsRead function

This commit is contained in:
csoler 2020-09-10 20:07:13 +02:00
parent 96a8c23f1e
commit 8d6bd1a0b8
3 changed files with 16 additions and 20 deletions

View file

@ -702,11 +702,15 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status)
{
for(uint32_t i=0;i<mPosts.size();++i)
{
bool post_status = (IS_MSG_UNREAD(mPosts[i].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[i].mMeta.mMsgStatus));
bool post_status = !((IS_MSG_UNREAD(mPosts[i].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[i].mMeta.mMsgStatus)));
if(post_status != read_status)
{
std::cerr << "Switch read status of post " << mPosts[i].mMeta.mMsgId << std::endl;
if(!rsGxsChannels->markRead(RsGxsGrpMsgIdPair(mPosts[i].mMeta.mGroupId,mPosts[i].mMeta.mMsgId),read_status))
RsErr() << "setAllMsgReadStatus: failed to change status of msg " << mPosts[i].mMeta.mMsgId << " in group " << mPosts[i].mMeta.mGroupId << " to status " << read_status << std::endl;
}
}
});
}