Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/19/2022 10:26:02 AM (4 years ago)
Author:
imath
Message:

Silently introduce block support for Activity content

Functions and filters bringing support for Block based activity content are disabled by default. We're adding these so that it's easier to progress on building a Block Based activity post form from a feature as a plugin and the BP Attachments BuddyPress Add-on. To allow Activity content to support blocks, we simply need to use this filter add_filter( 'bp_is_activity_blocks_active', '__return_true' ); .

This commit also allowes community users to share more than 2 links when these links are coming from the website BuddyPress is activated on.

Closes https://github.com/buddypress/buddypress/pull/38
Fixes #8765

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/functions.php

    r13316 r13370  
    918918                $this->assertTrue( 2 === count( $versions ) );
    919919        }
     920
     921        /**
     922         * Override the comment max links option.
     923         */
     924        public function override_comment_max_links() {
     925                return 2;
     926        }
     927
     928        /**
     929         * @ticket BP8765
     930         */
     931        public function test_bp_core_check_for_moderation() {
     932                $u = self::factory()->user->create();
     933                //<a href="%1$s">Hello</a>
     934                $content = sprintf(
     935                        '<!-- wp:paragraph -->
     936                        <p><strong>%1$s %2$s!</p>
     937                        <!-- /wp:paragraph -->',
     938                        'Hello',
     939                        'World'
     940                );
     941
     942                add_filter( 'pre_option_comment_max_links', array( $this, 'override_comment_max_links' ), 10, 0 );
     943
     944                $test = bp_core_check_for_moderation( $u, '', $content );
     945                $this->assertTrue( $test );
     946
     947                $content = sprintf(
     948                        '<!-- wp:paragraph -->
     949                        <p><strong>%1$s %2$s!</p>
     950                        <!-- /wp:paragraph -->',
     951                        'Hello',
     952                        '<a href="https://foo.bar">World</a>'
     953                );
     954
     955                $test = bp_core_check_for_moderation( $u, '', $content );
     956                $this->assertTrue( $test );
     957
     958                $content = sprintf(
     959                        '<!-- wp:paragraph -->
     960                        <p><strong>%1$s %2$s!</p>
     961                        <!-- /wp:paragraph -->',
     962                        '<a href="https://bar.foo">Hello</a>',
     963                        '<a href="https://foo.bar">World</a>'
     964                );
     965
     966                $test = bp_core_check_for_moderation( $u, '', $content );
     967                $this->assertFalse( $test );
     968
     969                $content = sprintf(
     970                        '<!-- wp:paragraph -->
     971                        <p><strong>%1$s %2$s !</p>
     972                        <!-- /wp:paragraph -->
     973                        <!-- wp:bp/image-attachment {"align":"center","url":"%3$s/bp-attachments/public/members/admin/view/635168b2e5aae34973bcb0c1f0bd86fd/","src":"%3$s/wp-content/uploads/buddypress/public/members/1/bp-6-0-0-slated.jpg"} /-->',
     974                        'Hello',
     975                        'World',
     976                        home_url()
     977                );
     978
     979                $test = bp_core_check_for_moderation( $u, '', $content );
     980                $this->assertTrue( $test );
     981
     982                remove_filter( 'pre_option_comment_max_links', array( $this, 'override_comment_max_links' ), 10, 0 );
     983        }
    920984}
Note: See TracChangeset for help on using the changeset viewer.