From 2a2a1e241e2d27a4785a25886cbb3a0d30776542 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Sat, 8 Aug 2026 16:50:04 +0200 Subject: [PATCH] Address review: identify posts by mThreadId alone getChannelAllContent() split the metas into posts and comments/votes on "mThreadId.isNull() && mParentId.isNull()". Only the first half of that test carries information: a post never has a thread id, a comment always carries the id of the post it belongs to, and a vote the id of the post whose comment is being voted. mParentId proves nothing, since comments written under the old comment paradigm have a null one. Reported by csoler on PR #351. Co-Authored-By: Claude Opus 5 (1M context) --- src/services/p3gxschannels.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/p3gxschannels.cc b/src/services/p3gxschannels.cc index 091753b55..cec7c596b 100644 --- a/src/services/p3gxschannels.cc +++ b/src/services/p3gxschannels.cc @@ -1552,8 +1552,14 @@ bool p3GxsChannels::getChannelAllContent( const RsGxsGroupId& channelId, std::vector post_metas; std::set wanted_msgs; + // Only mThreadId tells posts apart from the rest: a post never has one + // (createChannelPost leaves it null), while a comment always carries the id + // of the post it belongs to and a vote the id of the post being commented. + // mParentId is not usable here: comments written under the old paradigm have + // a null one. + for(auto& m: metas) - if(m.mThreadId.isNull() && m.mParentId.isNull()) + if(m.mThreadId.isNull()) post_metas.push_back(m); else wanted_msgs.insert(m.mMsgId); // comments and votes are all kept