Skip to content

Commit

Permalink
Simplify slack alert texts
Browse files Browse the repository at this point in the history
  • Loading branch information
hanifn committed Jun 12, 2024
1 parent 8bf4f9f commit 31ab216
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions modules/notifications/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,10 @@ function notification_status_change( $new_status, $old_status, $post ) {
$this->send_email( 'status-change', $post, $subject, $body );

if ( 'on' === $this->module->options->send_to_slack )
$this->send_to_slack( $body );
$format = __( '*%1$s* changed the status of *%2$s #%3$s - <%4$s|%5$s>* from *%6$s* to *%7$s*', 'edit-flow' );
$text = sprintf( $format, $current_user->display_name, $post_type, $post_id, $edit_link, $post_title, $old_status_friendly_name, $new_status_friendly_name );

$this->send_to_slack( $text );
}

}
Expand Down Expand Up @@ -773,11 +776,11 @@ function notification_comment( $comment ) {

$this->send_email( 'comment', $post, $subject, $body );

$format = "*%s* left a comment on *%s #%s - %s*\n\n %s";
$text = sprintf( $format, $comment->comment_author, $post_type, $post_id, $post_title, $comment->comment_content );

if ( 'on' === $this->module->options->send_to_slack )
$this->send_to_slack( $body );
$format = __( '*%1$s* left a comment on *%2$s #%3$s - <%4$s|%5$s>*' . "\n\n" . '%6$s', 'edit-flow' );
$text = sprintf( $format, $comment->comment_author, $post_type, $post_id, $edit_link, $post_title, $comment->comment_content );

$this->send_to_slack( $text );
}

function get_notification_footer( $post ) {
Expand Down

0 comments on commit 31ab216

Please sign in to comment.