mirror of
https://github.com/RetroShare/libretroshare.git
synced 2026-09-14 11:05:45 +05:00
gxsforums: document why getForumStatistics cannot use the generic statistic
RsGxsDataAccess::getGroupStatistic() looks like a drop-in replacement that would avoid rebuilding the whole post hierarchy, but its obsolete-version filter only ever marks the original message obsolete, so a post edited N times is counted N times and superseded versions keep their unread flag forever. Tried in the field: the unread counter stuck at a non-zero value with everything read, and jumped by the number of stored versions when one post was marked unread. Leave a warning in place so the shortcut is not attempted again, and state what the real optimisation is: factoring the version collapsing out of computeMessagesHierarchy() so both paths share it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
28f7f4d4dd
commit
3c16ed06fd
@ -1077,6 +1077,25 @@ bool p3GxsForums::getForumGroupStatistics(const RsGxsGroupId& ForumId,GxsGroupSt
|
||||
|
||||
bool p3GxsForums::getForumStatistics(const RsGxsGroupId& forumId,RsGxsForumStatistics& stat)
|
||||
{
|
||||
// NOTE: this rebuilds the whole post hierarchy just to increment three
|
||||
// counters, which is expensive on a large forum. It cannot be replaced by
|
||||
// the generic RsGxsDataAccess::getGroupStatistic(): that one collapses post
|
||||
// versions with
|
||||
//
|
||||
// if(!mOrigMsgId.isNull() && mOrigMsgId != mMsgId) obsolete.insert(mOrigMsgId)
|
||||
//
|
||||
// which only ever marks the *original* message obsolete. Every edit of a
|
||||
// post carries mOrigMsgId = the original, so a post edited N times is
|
||||
// counted N times instead of once, and superseded versions that were never
|
||||
// displayed keep their unread flag forever. computeMessagesHierarchy() below
|
||||
// does it properly: it groups the versions, merges chains, checks that the
|
||||
// editor is the original author or a moderator, and keeps only the most
|
||||
// recent one.
|
||||
//
|
||||
// Making this cheap means factoring that version collapsing out of
|
||||
// computeMessagesHierarchy() so both share it -- not reimplementing the rule
|
||||
// a second time.
|
||||
|
||||
// 1 - get group data
|
||||
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user