Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions modules/notifications/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -732,12 +732,24 @@ public function notification_status_change( $new_status, $old_status, $post ) {
$body .= sprintf( __( 'Author: %1$s (%2$s)', 'edit-flow' ), $post_author->display_name, $post_author->user_email ) . "\r\n";
}

$edit_link = htmlspecialchars_decode( get_edit_post_link( $post_id ) );
$edit_post_link = get_edit_post_link( $post_id );
if ( is_null( $edit_post_link ) ) {
return;
}

$edit_link = htmlspecialchars_decode( $edit_post_link );

if ( 'publish' != $new_status ) {
$view_link = add_query_arg( [ 'preview' => 'true' ], wp_get_shortlink( $post_id ) );
} else {
$view_link = htmlspecialchars_decode( get_permalink( $post_id ) );
$permalink = get_permalink( $post_id );
if ( is_null( $permalink ) ) {
return;
}

$view_link = htmlspecialchars_decode( $permalink );
}

$body .= "\r\n";
$body .= __( '== Actions ==', 'edit-flow' ) . "\r\n";
/* translators: 1: edit link */
Expand Down Expand Up @@ -830,8 +842,19 @@ public function notification_comment( $comment ) {
$body .= esc_html__( 'Notified', 'edit-flow' ) . ': ' . esc_html( $notification_list ) . "\n";
}

$edit_link = htmlspecialchars_decode( get_edit_post_link( $post_id ) );
$view_link = htmlspecialchars_decode( get_permalink( $post_id ) );
$edit_post_link = get_edit_post_link( $post_id );
if ( is_null( $edit_post_link ) ) {
return;
}

$edit_link = htmlspecialchars_decode( $edit_post_link );

$permalink = get_permalink( $post_id );
if ( is_null( $permalink ) ) {
return;
}

$view_link = htmlspecialchars_decode( $permalink );

$body .= "\r\n";
$body .= __( '== Actions ==', 'edit-flow' ) . "\r\n";
Expand Down
4 changes: 4 additions & 0 deletions tests/Integration/NotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public static function wpTearDownAfterClass() {
function test_send_post_notification_no_status() {
global $edit_flow;

wp_set_current_user( self::$admin_user_id );

$edit_flow->notifications->module->options->always_notify_admin = 'on';

$post = array(
Expand All @@ -75,6 +77,8 @@ function test_send_post_notification_no_status() {
function test_send_post_notification_no_status_custom_status_disabled_for_post_type() {
global $edit_flow, $typenow;

wp_set_current_user( self::$admin_user_id );

/**
* Prevent the registration of custom status to check if notification module will still
* work when custom status module is disabled and custom statuses are not registered
Expand Down
Loading