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) <noreply@anthropic.com>
This commit is contained in:
jolavillette 2026-08-08 16:50:04 +02:00
parent 494ce38f11
commit 2a2a1e241e

View File

@ -1552,8 +1552,14 @@ bool p3GxsChannels::getChannelAllContent( const RsGxsGroupId& channelId,
std::vector<RsMsgMetaData> post_metas;
std::set<RsGxsMessageId> 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