Skip to content

Commit 7d4d27a

Browse files
committed
Rename is_activity_quote to is_quote_activity
Refactored the function is_activity_quote to is_quote_activity for improved naming consistency. Updated all references and related tests to use the new function name.
1 parent 9b20c10 commit 7d4d27a

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

includes/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ function is_activity_reply( $data ) {
630630
*
631631
* @return boolean True if a quote, false if not.
632632
*/
633-
function is_activity_quote( $data ) {
633+
function is_quote_activity( $data ) {
634634
return ! empty( $data['object']['quote'] ) ||
635635
! empty( $data['object']['quoteUrl'] ) ||
636636
! empty( $data['object']['quoteUri'] ) ||

includes/handler/class-create.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use Activitypub\Collection\Posts;
1212

1313
use function Activitypub\get_activity_visibility;
14-
use function Activitypub\is_activity_quote;
1514
use function Activitypub\is_activity_reply;
15+
use function Activitypub\is_quote_activity;
1616
use function Activitypub\is_self_ping;
1717
use function Activitypub\object_id_to_comment;
1818

@@ -39,7 +39,7 @@ public static function handle_create( $activity, $user_ids, $activity_object = n
3939
// Check for private and/or direct messages.
4040
if ( ACTIVITYPUB_CONTENT_VISIBILITY_PRIVATE === get_activity_visibility( $activity ) ) {
4141
$result = false;
42-
} elseif ( is_activity_reply( $activity ) || is_activity_quote( $activity ) ) { // Check for replies and quotes.
42+
} elseif ( is_activity_reply( $activity ) || is_quote_activity( $activity ) ) { // Check for replies and quotes.
4343
$result = self::create_interaction( $activity, $user_ids, $activity_object );
4444
} elseif ( \get_option( 'activitypub_create_posts', false ) ) { // Handle non-interaction objects.
4545
$result = self::create_post( $activity, $user_ids, $activity_object );

tests/phpunit/tests/includes/class-test-functions.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,11 +1562,11 @@ public function test_is_activity_reply_returns_false_for_non_reply() {
15621562
}
15631563

15641564
/**
1565-
* Test is_activity_quote function with quote property.
1565+
* Test is_quote_activity function with quote property.
15661566
*
1567-
* @covers \Activitypub\is_activity_quote
1567+
* @covers \Activitypub\is_quote_activity
15681568
*/
1569-
public function test_is_activity_quote_with_quote() {
1569+
public function test_is_quote_activity_with_quote() {
15701570
$activity = array(
15711571
'type' => 'Create',
15721572
'object' => array(
@@ -1576,15 +1576,15 @@ public function test_is_activity_quote_with_quote() {
15761576
),
15771577
);
15781578

1579-
$this->assertTrue( \Activitypub\is_activity_quote( $activity ) );
1579+
$this->assertTrue( \Activitypub\is_quote_activity( $activity ) );
15801580
}
15811581

15821582
/**
1583-
* Test is_activity_quote function with quoteUrl property.
1583+
* Test is_quote_activity function with quoteUrl property.
15841584
*
1585-
* @covers \Activitypub\is_activity_quote
1585+
* @covers \Activitypub\is_quote_activity
15861586
*/
1587-
public function test_is_activity_quote_with_quote_url() {
1587+
public function test_is_quote_activity_with_quote_url() {
15881588
$activity = array(
15891589
'type' => 'Create',
15901590
'object' => array(
@@ -1594,15 +1594,15 @@ public function test_is_activity_quote_with_quote_url() {
15941594
),
15951595
);
15961596

1597-
$this->assertTrue( \Activitypub\is_activity_quote( $activity ) );
1597+
$this->assertTrue( \Activitypub\is_quote_activity( $activity ) );
15981598
}
15991599

16001600
/**
1601-
* Test is_activity_quote function with quoteUri property.
1601+
* Test is_quote_activity function with quoteUri property.
16021602
*
1603-
* @covers \Activitypub\is_activity_quote
1603+
* @covers \Activitypub\is_quote_activity
16041604
*/
1605-
public function test_is_activity_quote_with_quote_uri() {
1605+
public function test_is_quote_activity_with_quote_uri() {
16061606
$activity = array(
16071607
'type' => 'Create',
16081608
'object' => array(
@@ -1612,15 +1612,15 @@ public function test_is_activity_quote_with_quote_uri() {
16121612
),
16131613
);
16141614

1615-
$this->assertTrue( \Activitypub\is_activity_quote( $activity ) );
1615+
$this->assertTrue( \Activitypub\is_quote_activity( $activity ) );
16161616
}
16171617

16181618
/**
1619-
* Test is_activity_quote function with _misskey_quote property.
1619+
* Test is_quote_activity function with _misskey_quote property.
16201620
*
1621-
* @covers \Activitypub\is_activity_quote
1621+
* @covers \Activitypub\is_quote_activity
16221622
*/
1623-
public function test_is_activity_quote_with_misskey_quote() {
1623+
public function test_is_quote_activity_with_misskey_quote() {
16241624
$activity = array(
16251625
'type' => 'Create',
16261626
'object' => array(
@@ -1630,15 +1630,15 @@ public function test_is_activity_quote_with_misskey_quote() {
16301630
),
16311631
);
16321632

1633-
$this->assertTrue( \Activitypub\is_activity_quote( $activity ) );
1633+
$this->assertTrue( \Activitypub\is_quote_activity( $activity ) );
16341634
}
16351635

16361636
/**
1637-
* Test is_activity_quote returns false for non-quote.
1637+
* Test is_quote_activity returns false for non-quote.
16381638
*
1639-
* @covers \Activitypub\is_activity_quote
1639+
* @covers \Activitypub\is_quote_activity
16401640
*/
1641-
public function test_is_activity_quote_returns_false_for_non_quote() {
1641+
public function test_is_quote_activity_returns_false_for_non_quote() {
16421642
$activity = array(
16431643
'type' => 'Create',
16441644
'object' => array(
@@ -1647,6 +1647,6 @@ public function test_is_activity_quote_returns_false_for_non_quote() {
16471647
),
16481648
);
16491649

1650-
$this->assertFalse( \Activitypub\is_activity_quote( $activity ) );
1650+
$this->assertFalse( \Activitypub\is_quote_activity( $activity ) );
16511651
}
16521652
}

0 commit comments

Comments
 (0)