only switch read/unread status when necessary

This commit is contained in:
csoler 2020-08-29 18:40:13 +02:00
parent 89444537b1
commit ca49232ff1

View File

@ -701,7 +701,12 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status)
RsThread::async([this, read_status]()
{
for(uint32_t i=0;i<mPosts.size();++i)
rsGxsChannels->markRead(RsGxsGrpMsgIdPair(mPosts[i].mMeta.mGroupId,mPosts[i].mMeta.mMsgId),read_status);
{
bool post_status = (IS_MSG_UNREAD(mPosts[i].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[i].mMeta.mMsgStatus));
if(post_status != read_status)
rsGxsChannels->markRead(RsGxsGrpMsgIdPair(mPosts[i].mMeta.mGroupId,mPosts[i].mMeta.mMsgId),read_status);
}
});
}