From 3faa35cfb0a7ad9078d67abe739bae861bf48f1b Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Sun, 12 Apr 2026 18:10:25 +0200 Subject: [PATCH] Fixed message read status to use new method *Fixed default Avatars --- retroshare-gui/src/gui/TheWire/WireDialog.cpp | 16 +++++++--------- .../src/gui/feeds/WireNotifyGroupItem.cpp | 6 +++++- .../src/gui/feeds/WireNotifyPostItem.cpp | 10 +++++----- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.cpp b/retroshare-gui/src/gui/TheWire/WireDialog.cpp index fdcc6743c..2fb5f0418 100644 --- a/retroshare-gui/src/gui/TheWire/WireDialog.cpp +++ b/retroshare-gui/src/gui/TheWire/WireDialog.cpp @@ -1524,7 +1524,9 @@ WireGroupItem *WireDialog::findGroupItemWidget(const RsGxsGroupId &groupId) void WireDialog::markGroupAsRead(const RsGxsGroupId &groupId) { - // Fetch all message summaries in the background and mark each as read. + // Fetch all message summaries in the background and mark each as read + // using the blocking API — DB write is complete before each call returns, + // so the event arrives after the data is committed. RsThread::async([this, groupId]() { std::vector summaries; @@ -1537,15 +1539,11 @@ void WireDialog::markGroupAsRead(const RsGxsGroupId &groupId) for (auto &meta : summaries) { - uint32_t token; RsGxsGrpMsgIdPair msgIdPair(groupId, meta.mMsgId); - rsWire->setMessageReadStatus(token, msgIdPair, true); + rsWire->setMessageReadStatus(msgIdPair, true); } - // Refresh statistics and notify icon from the GUI thread. - RsQThreadUtils::postToObject([this, groupId]() - { - updateGroupStatisticsReal(groupId); - }, this); + // Stats will be refreshed automatically via the READ_STATUS_CHANGED events + // fired by setMessageReadStatus for each message. }); -} +} \ No newline at end of file diff --git a/retroshare-gui/src/gui/feeds/WireNotifyGroupItem.cpp b/retroshare-gui/src/gui/feeds/WireNotifyGroupItem.cpp index 7a0674d09..de069ff64 100644 --- a/retroshare-gui/src/gui/feeds/WireNotifyGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/WireNotifyGroupItem.cpp @@ -30,6 +30,8 @@ #include "gui/TheWire/WireDialog.h" #include "util/DateTime.h" +#define IMAGE_WIRE ":icons/wire.png" + /**** * #define DEBUG_ITEM 1 ****/ @@ -180,7 +182,9 @@ void WireNotifyGroupItem::fill() GxsIdDetails::loadPixmapFromData(mGroup.mHeadshot.mData, mGroup.mHeadshot.mSize, wireImage,GxsIdDetails::ORIGINAL); ui->logoLabel->setPixmap(QPixmap(wireImage)); } else { - ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/wire.png")); + // default. + QPixmap pixmap = GxsIdDetails::makeDefaultGroupIcon(mGroup.mMeta.mGroupId, IMAGE_WIRE, GxsIdDetails::ORIGINAL); + ui->logoLabel->setPixmap(pixmap); } //TODO - nice icon for subscribed group diff --git a/retroshare-gui/src/gui/feeds/WireNotifyPostItem.cpp b/retroshare-gui/src/gui/feeds/WireNotifyPostItem.cpp index 824af3131..7ac489f30 100644 --- a/retroshare-gui/src/gui/feeds/WireNotifyPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/WireNotifyPostItem.cpp @@ -35,6 +35,8 @@ #include #include +#define IMAGE_WIRE ":icons/wire.png" + WireNotifyPostItem::WireNotifyPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool autoUpdate, const std::set &older_versions) : GxsFeedItem(feedHolder, feedId, groupId, messageId, false, rsWire, autoUpdate) { @@ -330,7 +332,7 @@ void WireNotifyPostItem::doExpand(bool open) ui->expandButton->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/up-arrow.png"))); ui->expandButton->setToolTip(tr("Hide")); -// readToggled(false); + readToggled(false); } else { @@ -475,7 +477,7 @@ void WireNotifyPostItem::setGroup(const RsWireGroup &group) else { // default. - QPixmap pixmap = FilesDefs::getPixmapFromQtResourcePath(":/icons/wire.png"); + QPixmap pixmap = GxsIdDetails::makeDefaultGroupIcon(group.mMeta.mGroupId, IMAGE_WIRE, GxsIdDetails::ORIGINAL); ui->logoLabel->setPixmap(pixmap); } @@ -503,9 +505,7 @@ void WireNotifyPostItem::readToggled(bool /*checked*/) RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId()); - //rsWire->setMessageReadStatus(msgPair, isUnread()); - - //setReadStatus(false, checked); // Updated by events + rsWire->setMessageReadStatus(msgPair, isUnread()); } void WireNotifyPostItem::on_linkActivated(QString link)