Skip to:
Content

BuddyPress.org

Ticket #8120: 8120.patch

File 8120.patch, 2.5 KB (added by imath, 6 years ago)
  • src/bp-activity/classes/class-bp-activity-activity.php

    diff --git src/bp-activity/classes/class-bp-activity-activity.php src/bp-activity/classes/class-bp-activity-activity.php
    index f3335e77c..9499a4501 100644
    class BP_Activity_Activity { 
    15391539                                $descendant_ids = $wpdb->get_col( $sql );
    15401540                                $descendants    = self::get_activity_data( $descendant_ids );
    15411541                                $descendants    = self::append_user_fullnames( $descendants );
     1542                                $descendants    = self::generate_action_strings( $descendants );
    15421543                        }
    15431544
    15441545                        $ref = array();
  • tests/phpunit/testcases/activity/functions.php

    diff --git tests/phpunit/testcases/activity/functions.php tests/phpunit/testcases/activity/functions.php
    index 328742824..e4974ea2c 100644
    Bar!'; 
    753753                $this->assertSame( $expected, $a_obj->action );
    754754        }
    755755
     756        /**
     757         * @group activity_action
     758         * @group bp_activity_format_activity_action_activity_comment
     759         * @ticket BP8120
     760         */
     761        public function test_bp_activity_format_activity_action_children_activity_comment() {
     762                $u = self::factory()->user->create();
     763                $a1 = self::factory()->activity->create( array(
     764                        'component' => buddypress()->activity->id,
     765                        'type'      => 'activity_update',
     766                        'user_id'   => $u,
     767                ) );
     768
     769                $ac1 = self::factory()->activity->create( array(
     770                        'type'              => 'activity_comment',
     771                        'item_id'           => $a1,
     772                        'secondary_item_id' => $a1,
     773                        'user_id'           => $u,
     774                ) );
     775
     776                $ac2 = self::factory()->activity->create( array(
     777                        'type'              => 'activity_comment',
     778                        'item_id'           => $a1,
     779                        'secondary_item_id' => $ac1,
     780                        'user_id'           => $u,
     781                ) );
     782
     783                // Remove all action strings
     784                $table = buddypress()->activity->table_name;
     785                $GLOBALS['wpdb']->query( "UPDATE {$table} set action = '' WHERE id IN ( {$a1}, {$ac1}, {$ac2} )" );
     786
     787                $get = bp_activity_get( array(
     788                        'in'               => array( $a1 ),
     789                        'display_comments' => 'thread'
     790                ) );
     791
     792                $activity    = reset( $get['activities'] );
     793                $comment_one = reset( $activity->children );
     794                $comment_two = reset( $comment_one->children );
     795                $user_link   = bp_core_get_userlink( $u );
     796
     797                $this->assertSame( sprintf( '%s posted a new activity comment', $user_link ), $comment_one->action );
     798                $this->assertSame( sprintf( '%s posted a new activity comment', $user_link ), $comment_two->action );
     799        }
     800
    756801        /**
    757802         * @group activity_action
    758803         * @group bp_activity_format_activity_action_custom_post_type_post