Skip to content

Commit af9e12f

Browse files
committed
changelog
1 parent ad81953 commit af9e12f

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Improved
1111

12+
* Direct Messages: Test for the user being in the to field
1213
* Direct Messages: Improve HTML to e-mail text conversion
1314

1415
## [4.5.1] - 2024-12-18

includes/class-mailer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ public static function direct_message( $activity, $user_id ) {
152152

153153
if (
154154
is_activity_public( $activity ) ||
155-
! in_array( \get_author_posts_url( $user_id ), $recipients )
155+
! in_array( \get_author_posts_url( $user_id ), $recipients, true )
156156
) {
157157
return;
158158
}
159159

160160
// Only accept messages that have the user in the "to" field.
161-
if ( ! in_array( \get_author_posts_url( $user_id ), $activity['to'] ) ) {
161+
if ( ! in_array( \get_author_posts_url( $user_id ), $activity['to'], true ) ) {
162162
return;
163163
}
164164

readme.txt

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ For reasons of data protection, it is not possible to see the followers of other
134134

135135
= Unreleased =
136136

137+
* Direct Messages: Test for the user being in the to field
137138
* Improved: HTML to e-mail text conversion
138139

139140
= 4.5.1 =

tests/includes/class-test-mailer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function direct_message_provider() {
282282
'to' => array( 'https://example.com/followers' ),
283283
),
284284
),
285-
'reply+cc' => array(
285+
'reply+cc' => array(
286286
false,
287287
array(
288288
'actor' => 'https://example.com/author',
@@ -311,7 +311,7 @@ public function test_direct_message( $send_email, $activity ) {
311311

312312
// We need to replace back in the user URL because the user_id is not available in the data provider.
313313
$replace = function ( $url ) use ( $user_id ) {
314-
if ( $url === 'user_url' ) {
314+
if ( 'user_url' === $url ) {
315315
return get_author_posts_url( $user_id );
316316
}
317317
return $url;
@@ -406,7 +406,7 @@ public function test_direct_message_text( $text, $expected ) {
406406
'object' => array(
407407
'content' => $text,
408408
),
409-
'to' => array( get_author_posts_url( $user_id ) ),
409+
'to' => array( get_author_posts_url( $user_id ) ),
410410
);
411411

412412
// Mock remote metadata.

0 commit comments

Comments
 (0)