Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/09/2019 05:35:42 AM (5 years ago)
Author:
johnjamesjacoby
Message:

Counts (meta-data): full audit of forum/topic/reply, public/non-public counts.

This commit is the result of a full count audit, exposing multiple inconsistencies and voids in relation to how public and non-public counts are (re)calculated.

For instance, hidden forum replies are not counted at all, until now. By introducing a new Repair tool, hidden forum reply counts are now counted.

In addition, there were multiple bugs with topic & reply moderation, where the act of approving or unapproving topics or replies would cause the numbers to be inaccurate, or where topics & replies being caught in moderation were still increasing public counts.

It was also possible to, as a Key Master, publicly reply to unapproved topics, which was a completely unanticipated side-effect of allowing Key Masters to do pretty much anything. Going forward, the default reply status is the topic status, but is still beholden to all existing moderation settings and user role capabilities. This results in a more sane user experience, and prevents the unusual circumstance of there being "0 topics and 30 replies" in public-facing forums.

Certain count increase/decrease actions have been reprioritized to avoid collisions and race conditions, proving once again that ya gotta get up to get down.

See #2838. Fixes #1799.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/functions.php

    r6922 r6923  
    16641664    }
    16651665
    1666     // Get the public posts status
    1667     $post_status = array( bbp_get_public_status_id() );
    1668 
    1669     // Add closed status if topic post type
    1670     if ( bbp_get_topic_post_type() === $post_type ) {
    1671         $post_status[] = bbp_get_closed_status_id();
     1666    // Which statuses
     1667    switch ( $post_type ) {
     1668
     1669        // Forum
     1670        case bbp_get_forum_post_type() :
     1671            $post_status = bbp_get_public_forum_statuses();
     1672            break;
     1673
     1674        // Topic
     1675        case bbp_get_topic_post_type() :
     1676            $post_status = bbp_get_public_topic_statuses();
     1677            break;
     1678
     1679        // Reply
     1680        case bbp_get_reply_post_type() :
     1681        default :
     1682            $post_status = bbp_get_public_reply_statuses();
     1683            break;
    16721684    }
    16731685
     
    18231835        // Forum
    18241836        case bbp_get_forum_post_type() :
    1825             $post_status = array( bbp_get_public_status_id() );
     1837            $post_status = bbp_get_public_forum_statuses();
    18261838            break;
    18271839
Note: See TracChangeset for help on using the changeset viewer.