Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/12/2017 09:23:32 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Engagements: Revert part of r6525, and adjust some actions.

  • Engagements will need to be "public only" for 2.6, and we can reconsider what private/hidden engagements look like later
  • Make sure that engagements are saved before voice counts are done
  • Use new is_public style wrapper function for topics & replies where appropriate
  • Remove a few current_filter() checks that should no longer be necessary with current action hook implementation
  • There may be more clean-up necessary here, but this is required to bring all unit-tests back to passing as they've been written, specifically things hooked to the bbp_insert_topic and bbp_insert_reply hooks

See #3068. Hat-tip netweb.

File:
1 edited

Legend:

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

    r6529 r6534  
    25182518
    25192519        // If this is a new, unpublished, reply, update hidden count and bail.
    2520         if ( 'bbp_new_reply' === current_filter() && ! bbp_is_reply_published( $reply_id ) ) {
     2520        if ( ! bbp_is_reply_published( $reply_id ) ) {
    25212521            bbp_increase_topic_reply_count_hidden( $topic_id );
    25222522            return;
     
    26642664
    26652665    // If the topic is public, update the forum topic counts.
    2666     if ( bbp_get_topic_status( $topic_id ) === bbp_get_public_status_id() ) {
     2666    if ( bbp_is_topic_public( $topic_id ) ) {
    26672667        bbp_increase_forum_topic_count( $forum_id );
    26682668
     
    26952695
    26962696    // If it's a reply, then get the parent (topic id)
    2697     if ( bbp_is_reply( $topic_id ) ) {
    2698         $topic_id = bbp_get_reply_topic_id( $topic_id );
    2699     } else {
    2700         $topic_id = bbp_get_topic_id( $topic_id );
    2701     }
    2702 
     2697    $topic_id = bbp_is_reply( $topic_id )
     2698        ? bbp_get_reply_topic_id( $topic_id )
     2699        : bbp_get_topic_id( $topic_id );
     2700
     2701    // Forum ID fallback
    27032702    if ( empty( $forum_id ) ) {
    27042703        $forum_id = get_post_field( 'post_parent', $topic_id );
     
    27532752
    27542753    // If it's a reply, then get the parent (topic id)
    2755     if ( bbp_is_reply( $topic_id ) ) {
    2756         $topic_id = bbp_get_reply_topic_id( $topic_id );
    2757     } else {
    2758         $topic_id = bbp_get_topic_id( $topic_id );
    2759     }
     2754    $topic_id = bbp_is_reply( $topic_id )
     2755        ? bbp_get_reply_topic_id( $topic_id )
     2756        : bbp_get_topic_id( $topic_id );
    27602757
    27612758    // Get replies of topic if not passed
     
    27972794
    27982795    // If it's a reply, then get the parent (topic id)
    2799     if ( bbp_is_reply( $topic_id ) ) {
    2800         $topic_id = bbp_get_reply_topic_id( $topic_id );
    2801     } else {
    2802         $topic_id = bbp_get_topic_id( $topic_id );
    2803     }
     2796    $topic_id = bbp_is_reply( $topic_id )
     2797        ? bbp_get_reply_topic_id( $topic_id )
     2798        : bbp_get_topic_id( $topic_id );
    28042799
    28052800    // Get replies of topic
     
    28412836
    28422837    // If it's a reply, then get the parent (topic id)
    2843     if ( bbp_is_reply( $topic_id ) ) {
    2844         $topic_id = bbp_get_reply_topic_id( $topic_id );
    2845     } else {
    2846         $topic_id = bbp_get_topic_id( $topic_id );
    2847     }
    2848 
     2838    $topic_id = bbp_is_reply( $topic_id )
     2839        ? bbp_get_reply_topic_id( $topic_id )
     2840        : bbp_get_topic_id( $topic_id );
     2841
     2842    // Get last public active id if not passed
    28492843    if ( empty( $active_id ) ) {
    28502844        $active_id = bbp_get_public_child_last_id( $topic_id, bbp_get_reply_post_type() );
     
    28862880
    28872881    // If it's a reply, then get the parent (topic id)
    2888     if ( bbp_is_reply( $topic_id ) ) {
    2889         $topic_id = bbp_get_reply_topic_id( $topic_id );
    2890     } else {
    2891         $topic_id = bbp_get_topic_id( $topic_id );
    2892     }
     2882    $topic_id = bbp_is_reply( $topic_id )
     2883        ? bbp_get_reply_topic_id( $topic_id )
     2884        : bbp_get_topic_id( $topic_id );
    28932885
    28942886    // Check time and use current if empty
     
    30193011
    30203012    // If it's a reply, then get the parent (topic id)
    3021     if ( bbp_is_reply( $topic_id ) ) {
    3022         $topic_id = bbp_get_reply_topic_id( $topic_id );
    3023     } elseif ( bbp_is_topic( $topic_id ) ) {
    3024         $topic_id = bbp_get_topic_id( $topic_id );
    3025     } else {
    3026         return;
    3027     }
     3013    $topic_id = bbp_is_reply( $topic_id )
     3014        ? bbp_get_reply_topic_id( $topic_id )
     3015        : bbp_get_topic_id( $topic_id );
    30283016
    30293017    // Query the DB to get anonymous replies in this topic
     
    34523440
    34533441/**
    3454  * Retreive tags to a topic from post meta before it's unmarked as spam so they.
     3442 * Retrieve tags to a topic from post meta before it's unmarked as spam so they.
    34553443 *
    34563444 * Usually you'll want to do this before the topic itself is unmarked as spam.
Note: See TracChangeset for help on using the changeset viewer.