Skip to content

Commit

Permalink
Notifications not sent for auto-submitted revisions
Browse files Browse the repository at this point in the history
Fixes #1310
  • Loading branch information
agapetry committed Jul 3, 2024
1 parent 9e0dafd commit 7531281
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion admin/revision-action_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function rvy_revision_create($post_id = 0, $args = []) {
if (!empty($args['force']) || current_user_can('copy_post', $main_post_id)) {
require_once( dirname(REVISIONARY_FILE).'/revision-creation_rvy.php' );
$rvy_creation = new PublishPress\Revisions\RevisionCreation();
$revision_id = $rvy_creation->createRevision($post_id, 'draft-revision', $args);

$revision_status = (rvy_get_option('auto_submit_revisions') && current_user_can('edit_post', $main_post_id)) ? 'pending-revision' : 'draft-revision';
$revision_id = $rvy_creation->createRevision($post_id, $revision_status, $args);
} else {
$revision_id = 0;
}
Expand Down
8 changes: 8 additions & 0 deletions revision-creation_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ function createRevision($post_id, $revision_status, $args = []) {

$post = get_post($revision_id);

if (('pending-revision' == $revision_status) && !defined('REVISONARY_AUTO_SUBMIT_NO_NOTIFICATION')) {
require_once( dirname(REVISIONARY_FILE).'/revision-workflow_rvy.php' );
$rvy_workflow_ui = new \Rvy_Revision_Workflow_UI();

$args = ['revision_id' => $revision_id, 'published_post' => $published_post, 'object_type' => $published_post->post_type];
$rvy_workflow_ui->do_notifications('pending-revision', 'pending-revision', (array) $published_post, $args );
}

$url = apply_filters('revisionary_create_revision_redirect', rvy_admin_url("post.php?post=$revision_id&action=edit"), $revision_id);

if (!empty($args['suppress_redirect'])) {
Expand Down

0 comments on commit 7531281

Please sign in to comment.