gui(forums): re-read the group on SUBSCRIBE_STATUS_CHANGED instead of flipping the flag

The event means the subscription status changed, not that it was
toggled: guessing the new value by inverting the current flag goes
wrong as soon as one event is duplicated, lost, or refers to a state
the widget already holds. When the guess lands on 'unsubscribed', the
widget silently refuses to mark posts read or unread (the very first
check of markMsgAsReadUnread) until the next group reload puts the flag
right again. updateGroupData() was already called anyway; let it be the
only writer of the flag.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
jolavillette 2026-07-29 12:45:23 +02:00
parent b0ca91c825
commit 5cbcd962dd

View File

@ -415,16 +415,12 @@ void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED:
if(e->mForumGroupId == mForumGroup.mMeta.mGroupId)
{
// Toggle subscribe flag locally and refresh UI without GXS request
// to avoid concurrent request with parent dialog's tree rebuild
if(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags))
mForumGroup.mMeta.mSubscribeFlags &= ~GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED;
else
mForumGroup.mMeta.mSubscribeFlags |= GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED;
// Re-read the group instead of guessing the new flag by flipping
// the current one: the event says the status changed, not that it
// was toggled, and a wrong guess makes the widget believe the
// forum is unsubscribed, which silently disables marking posts
// read or unread until the group data comes back.
updateGroupData();
}
break;
default: break;