From 5cbcd962dd1432100596ba083679ff80766211b1 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Wed, 29 Jul 2026 12:45:23 +0200 Subject: [PATCH] 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) --- .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index e37f783cb..e71a400b2 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -415,16 +415,12 @@ void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptrmForumGroupId == 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;