Changeset 10121
- Timestamp:
- 08/06/2020 07:44:59 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 4 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php
r10000 r10121 3 3 4 4 use WP_User; 5 use WordPressdotorg\Plugin_Directory\Email\Committer_Added_Notification; 6 use WordPressdotorg\Plugin_Directory\Email\Support_Rep_Added_Notification; 5 7 6 8 /** … … 205 207 $plugin_slug 206 208 ); 209 210 // Only notify if the current process is interactive - a user is logged in. 211 $should_notify = (bool) get_current_user_id(); 212 // Don't notify if a plugin admin is taking action on a plugin they're not (yet) a committer for. 213 if ( current_user_can( 'plugin_approve' ) && ! in_array( wp_get_current_user()->user_login, $existing_committers, true ) ) { 214 $should_notify = false; 215 } 216 217 if ( $should_notify ) { 218 $existing_committers[] = $user->user_login; 219 220 $email = new Committer_Added_Notification( 221 $plugin_slug, 222 $existing_committers, 223 [ 224 'committer' => $user, 225 ] 226 ); 227 $email->send(); 228 } 207 229 208 230 return $result; … … 353 375 ); 354 376 377 $committers = self::get_plugin_committers( $plugin_slug ); 378 379 // Only notify if the current process is interactive - a user is logged in. 380 $should_notify = (bool) get_current_user_id(); 381 // Don't notify if a plugin admin is taking action on a plugin they're not a committer for. 382 if ( current_user_can( 'plugin_approve' ) && ! in_array( wp_get_current_user()->user_login, $committers, true ) ) { 383 $should_notify = false; 384 } 385 386 if ( $should_notify ) { 387 $email = new Support_Rep_Added_Notification( 388 $plugin_slug, 389 $committers, 390 [ 391 'rep' => $user, 392 ] 393 ); 394 $email->send(); 395 } 396 355 397 return $result; 356 398 }
Note: See TracChangeset
for help on using the changeset viewer.