Changeset 12063 for sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-notifications.php
- Timestamp:
- 09/15/2022 03:13:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-notifications.php
r12003 r12063 34 34 if ( ( '0' !== $comment->comment_parent ) ) { // Notify to the thread only if the comment is in a thread. 35 35 self::send_emails_to_thread_commenters( $comment, $comment_meta ); 36 }37 if ( ( '0' === $comment->comment_parent ) && array_key_exists( 'reject_reason', $comment_meta ) && ( ! empty( $comment_meta['reject_reason'] ) ) ) { // Notify a rejection without parent comments.38 self::send_rejection_email_to_translator( $comment, $comment_meta );39 36 } 40 37 $root_comment = self::get_root_comment_in_a_thread( $comment ); … … 50 47 break; 51 48 } 49 } elseif ( ( '0' === $comment->comment_parent ) ) { // Notify an approval, rejection or fuzzy without parent comments. 50 self::send_action_email_to_translator( $comment, $comment_meta ); 52 51 } 53 52 } … … 104 103 105 104 /** 106 * Sends the reject notificationto the translator.105 * Sends the action notification (approval, rejection, fuzzy) to the translator. 107 106 * 108 107 * @since 0.0.2 … … 113 112 * @return void 114 113 */ 115 public static function send_ rejection_email_to_translator( WP_Comment $comment, array $comment_meta ) {114 public static function send_action_email_to_translator( WP_Comment $comment, array $comment_meta ) { 116 115 $translation_id = $comment_meta['translation_id']; 117 116 $translation = GP::$translation->get( $translation_id ); 118 $translator = get_user_by( 'id', $translation->user_id _last_modified);117 $translator = get_user_by( 'id', $translation->user_id ); 119 118 if ( false === $translator ) { 120 $translator = get_user_by( 'id', $translation->user_id ); 121 } 122 self::send_emails( $comment, $comment_meta, array( $translator->user_email ) ); 119 $translator = get_user_by( 'id', $translation->user_id_last_modified ); 120 } 121 if ( false === $translator ) { 122 self::send_emails( $comment, $comment_meta, array( $translator->user_email ) ); 123 } 123 124 } 124 125 … … 422 423 } 423 424 } 425 if ( isset( $comment_meta['reject_reason'][0] ) && ! empty( maybe_unserialize( $comment_meta['reject_reason'][0] ) ) ) { 426 $reasons = array(); 427 $comment_reasons = Helper_Translation_Discussion::get_comment_reasons(); 428 $reasons = array_map( 429 function( $reason ) use ( $comment_reasons ) { 430 if ( array_key_exists( $reason, $comment_reasons ) ) { 431 return $comment_reasons[ $reason ]['name']; 432 } 433 }, 434 maybe_unserialize( $comment_meta['reject_reason'][0] ) 435 ); 436 /* translators: The reason(s) for rejection. */ 437 $output .= '- ' . wp_kses( sprintf( __( '<strong>Reason(s):</strong> %s', 'glotpress' ), implode( ', ', $reasons ) ), array( 'strong' => array() ) ) . '<br/>'; 438 } 424 439 /* translators: The comment made. */ 425 440 $output .= '- ' . wp_kses( sprintf( __( '<strong>Comment:</strong> %s', 'glotpress' ), $comment->comment_content ), array( 'strong' => array() ) ) . '<br/>';
Note: See TracChangeset
for help on using the changeset viewer.