Skip to content

Commit

Permalink
Merge pull request #1303 from publishpress/release-3.5.11
Browse files Browse the repository at this point in the history
Release 3.5.11
  • Loading branch information
agapetry authored Jun 27, 2024
2 parents c6e439c + b00714e commit 4def8d2
Show file tree
Hide file tree
Showing 19 changed files with 454 additions and 2,690 deletions.
7 changes: 7 additions & 0 deletions admin/admin-init_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ function _rvy_post_edit_ui() {
if ($pagenow == 'post.php') {
require_once( dirname(__FILE__).'/post-editor-workflow-ui_rvy.php' );

add_action('init', function() {
if (rvy_get_option('revision_limit_per_post')) {
$post_id = rvy_detect_post_id();
revisionary_refresh_postmeta($post_id);
}
});

if (\PublishPress\Revisions\Utils::isBlockEditorActive()) {
require_once( dirname(__FILE__).'/post-edit-block-ui_rvy.php' );
} else {
Expand Down
22 changes: 15 additions & 7 deletions admin/class-list-table_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ function do_query( $q = false ) {
add_filter($filter_name, [$this, 'pre_query_filter'], 5, 2);
add_filter($filter_name, [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);

add_filter('presspermit_posts_where_extra_exception_ops',
function($exception_ops, $args) {
$exception_ops []= 'revise';
return $exception_ops;
}, 10, 2
);
if (defined('REVISIONARY_USE_QUEUE_EXCEPTIONS_FILTER')) { // @todo: confirm this is obsolete
add_filter('presspermit_posts_where_extra_exception_ops',
function($exception_ops, $args) {
$exception_ops []= 'revise';
return $exception_ops;
}, 10, 2
);
}

$pre_query = new WP_Query( $qp );

Expand Down Expand Up @@ -569,7 +571,7 @@ function rvy_pending_list_register_columns( $columns ) {

$arr['post_author'] = pp_revisions_label('queue_col_post_author');

return $arr;
return apply_filters('revisionary_list_table_columns', $arr);
}

function rvy_pending_custom_col( $column_name, $post_id ) {
Expand Down Expand Up @@ -679,6 +681,12 @@ function rvy_pending_custom_col( $column_name, $post_id ) {
$author_caption = get_the_author_meta('display_name', $parent_post->post_author);
$this->apply_edit_link(add_query_arg('post_author', $parent_post->post_author, $request_url), $author_caption);
}

break;

default:
do_action('revisionary_list_table_custom_col', $column_name, $post);

} // end switch
}

Expand Down
25 changes: 17 additions & 8 deletions admin/post-edit-block-ui_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ public static function act_object_guten_scripts() {
$args = \PublishPress\Revisions\PostEditorWorkflowUI::postLinkParams(compact('post', 'do_pending_revisions', 'do_scheduled_revisions'));
}

$wp_timezone = wp_timezone();
$utc_timezone = new DateTimeZone('UTC');
$wp_time = new DateTime("now", $wp_timezone);
$utc_time = new DateTime("now", new DateTimeZone('UTC'));

$args['timezoneOffset'] = 0 - $wp_timezone->getOffset($utc_time);

wp_localize_script( 'rvy_object_edit', 'rvyObjEdit', $args );
}

Expand Down Expand Up @@ -144,14 +151,16 @@ public static function author_ui() {
/* <![CDATA[ */
jQuery(document).ready( function($) {
$(document).on('loaded-ui', 'div.rvy-submission-div', function() {
$('div.rvy-submission-div').append(
"<br /><div class='rvy-author-selection'>"
+ '<label>' + '<?php _e("Author", 'revisionary');?>&nbsp;</label>'
+ '</div>'
+ "<br /><div class='rvy-author-selection'>"
+ "<?php echo $select_html;?>"
+ '</div>'
);
if (!$('div.rvy-author-selection').length) {
$('div.rvy-submission-div').append(
"<br /><div class='rvy-author-selection'>"
+ '<label>' + '<?php _e("Author", 'revisionary');?>&nbsp;</label>'
+ '</div>'
+ "<br /><div class='rvy-author-selection'>"
+ "<?php echo $select_html;?>"
+ '</div>'
);
}
});

$(document).on('change', 'div.rvy-author-selection select', function(e) {
Expand Down
4 changes: 4 additions & 0 deletions admin/revision-action_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,10 @@ function rvy_apply_revision( $revision_id, $actual_revision_status = '' ) {
do_action('litespeed_purge_post', $published->ID);
}

if (function_exists('rocket_clean_post') && !defined('REVISIONARY_DISABLE_ROCKET_CLEAN')) {
rocket_clean_post($published->ID);
}

// Passing ignore_revision_ids is not theoretically necessary here since this call occurs after deletion, but avoid any cache clearance timing issues.
revisionary_refresh_revision_flags($published->ID, ['ignore_revision_ids' => $revision_id]);

Expand Down
5 changes: 4 additions & 1 deletion admin/revision-queue_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
set_current_screen( 'revisionary-q' );

require_once( dirname(__FILE__).'/class-list-table_rvy.php');
$wp_list_table = new Revisionary_List_Table(['screen' => 'revisionary-q', 'post_types' => $post_types]);

$list_table_class = apply_filters('revisionary_list_table_class', 'Revisionary_List_Table');

$wp_list_table = new $list_table_class(['screen' => 'revisionary-q', 'post_types' => $post_types]);
$pagenum = $wp_list_table->get_pagenum();

$parent_file = 'admin.php?page=revisionary-q';
Expand Down
4 changes: 4 additions & 0 deletions admin/rvy-revision-edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ font-weight: bold;
div.edit-post-post-status h2 {
margin-top: 10px !important;
}

div.gutenberg-18-5 {
padding-left: 12px;
}
39 changes: 30 additions & 9 deletions admin/rvy_post-block-edit.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,28 @@ jQuery(document).ready( function($) {
var selectedDateHTML = $('button.edit-post-post-schedule__toggle').html();

if (! /\d/.test(selectedDateHTML) || !rvyIsPublished) {
RvyTimeSelection = '';
$('.rvy-creation-ui .revision-schedule').hide();
$('.rvy-creation-ui .revision-scheduled').hide();
$('.rvy-creation-ui .revision-creating').hide();
$('.rvy-creation-ui .revision-created').hide();
$('.rvy-creation-ui .revision-create').show();
return;

selectedDateHTML = $('button.editor-post-schedule__dialog-toggle').html();

if (! /\d/.test(selectedDateHTML) || !rvyIsPublished) {
RvyTimeSelection = '';
$('.rvy-creation-ui .revision-schedule').hide();
$('.rvy-creation-ui .revision-scheduled').hide();
$('.rvy-creation-ui .revision-creating').hide();
$('.rvy-creation-ui .revision-created').hide();
$('.rvy-creation-ui .revision-create').show();
return;
}
}

selectedDateHTML = wp.data.select('core/editor').getEditedPostAttribute('date');
var selectedDate = new Date( selectedDateHTML );

var currentDate = new Date();

RvyTimeSelection = selectedDate.getTime();
var tdiff = RvyTimeSelection - Date.now();
RvyTimeSelection = selectedDate.getTime() - ((currentDate.getTimezoneOffset() * 60 - rvyObjEdit.timezoneOffset) * 1000);

var tdiff = RvyTimeSelection - currentDate.getTime();

RvyTimeSelection = RvyTimeSelection / 1000; // pass seconds to server

Expand Down Expand Up @@ -323,6 +330,20 @@ jQuery(document).ready( function($) {
}
RvyDetectPublishOptionsDivClosureInterval = setInterval(RvyDetectPublishOptionsClosure, 200);
}

if ( $('div.editor-post-schedule__dialog').length ) {
clearInterval( RvyDetectPublishOptionsDivInterval );

var RvyDetectPublishOptionsClosure = function() {
if ( ! $('div.editor-post-schedule__dialog').length ) {
clearInterval(RvyDetectPublishOptionsDivClosureInterval);
RvyDetectPublishOptionsDivInterval = setInterval(RvyDetectPublishOptionsDiv, 500);

RvyRefreshScheduleButton();
}
}
RvyDetectPublishOptionsDivClosureInterval = setInterval(RvyDetectPublishOptionsClosure, 200);
}
}

var RvyDetectPublishOptionsDivInterval = setInterval(RvyDetectPublishOptionsDiv, 500);
Expand Down
6 changes: 4 additions & 2 deletions admin/rvy_post-block-edit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 59 additions & 22 deletions admin/rvy_revision-block-edit.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ jQuery(document).ready(function ($) {
var RvyHideInterval = setInterval(RvyHideElements, 50);

var RvySubmissionUI = function () {
if (!$('div.editor-post-schedule__panel-dropdown:visible').length) {
$('.rvy-creation-ui').remove();
}

if ($('.rvy-creation-ui').length) {
return;
}

$('button.edit-post-post-visibility__toggle, div.editor-post-url__panel-dropdown, div.components-checkbox-control').closest("div.editor-post-panel__row").hide();

if ($('div.edit-post-sidebar div.edit-post-post-status div.editor-post-panel__row:last').length) {
Expand All @@ -151,7 +159,12 @@ jQuery(document).ready(function ($) {
var refSelector = 'div.edit-post-post-visibility';

if (!$(refSelector).length) {
refSelector = 'div.edit-post-post-status h2';
// Gutenberg 18.5
if ($('div.editor-post-panel__section').length) {
refSelector = 'div.editor-post-panel__section';
} else {
refSelector = 'div.edit-post-post-status h2';
}
}
}
}
Expand All @@ -166,27 +179,49 @@ jQuery(document).ready(function ($) {
var labelClose = '</span>';
var statusWrapperClass = '';
}

var rvyUI = '<div class="components-panel__row rvy-creation-ui edit-post-revision-status">'
+ labelOpen + rvyObjEdit.statusLabel + labelClose;

if (statusWrapperClass) {
rvyUI += '<div class="' + statusWrapperClass + '">';
}
if (refSelector == 'div.editor-post-panel__section') {
var rvyUI = '';

rvyUI += '<div class="components-dropdown rvy-current-status">'
+ rvyObjEdit[rvyObjEdit.currentStatus + 'StatusCaption']
+ '</div>';
if (statusWrapperClass) {
statusWrapperClass += ' gutenberg-18-5';

if (statusWrapperClass) {
rvyUI += '</div>';
}
rvyUI += '<div class="' + statusWrapperClass + '">';
}

rvyUI += '</div>';
rvyUI += '<div class="components-dropdown rvy-current-status">'
+ rvyObjEdit[rvyObjEdit.currentStatus + 'StatusCaption']
+ '</div>';

$(refSelector).before(
rvyUI
);
if (statusWrapperClass) {
rvyUI += '</div>';
}

$('div.editor-post-panel__row-control div.editor-post-status').html(
rvyUI
);
} else {
var rvyUI = '<div class="components-panel__row rvy-creation-ui edit-post-revision-status">'
+ labelOpen + rvyObjEdit.statusLabel + labelClose;

if (statusWrapperClass) {
rvyUI += '<div class="' + statusWrapperClass + '">';
}

rvyUI += '<div class="components-dropdown rvy-current-status">'
+ rvyObjEdit[rvyObjEdit.currentStatus + 'StatusCaption']
+ '</div>';

if (statusWrapperClass) {
rvyUI += '</div>';
}

rvyUI += '</div>';

$(refSelector).before(
rvyUI
);
}

if (rvyObjEdit[rvyObjEdit.currentStatus + 'ActionURL']) {
var url = rvyObjEdit[rvyObjEdit.currentStatus + 'ActionURL'];
Expand Down Expand Up @@ -219,8 +254,14 @@ jQuery(document).ready(function ($) {
rvyPreviewLink = '<br /><a href="' + rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedURL'] + '" class="revision-approve revision-preview components-button is-secondary ppr-purple-button" target="pp_revisions_copy">'
+ rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedLinkCaption'] + '</a>';
}

if (refSelector == 'div.editor-post-panel__section') {
divClass = ' gutenberg-18-5';
} else {
divClass = '';
}

$(refSelector).after('<div class="rvy-creation-ui rvy-submission-div"><a href="' + url + '" class="revision-approve">'
$(refSelector).after('<div class="rvy-creation-ui rvy-submission-div' + divClass + '"><a href="' + url + '" class="revision-approve">'
+ '<button type="button" class="components-button revision-approve is-button is-primary ppr-purple-button">'
+ '<span class="dashicons ' + mainDashicon + '"></span>'
+ rvyObjEdit[rvyObjEdit.currentStatus + 'ActionCaption'] + '</button></a>'
Expand All @@ -242,10 +283,6 @@ jQuery(document).ready(function ($) {
}

$('.edit-post-post-schedule__toggle').after('<button class="components-button is-tertiary post-schedule-footnote" disabled>' + rvyObjEdit.onApprovalCaption + '</button>');

if (rvyObjEdit[rvyObjEdit.currentStatus + 'DeletionURL']) {
$('button.editor-post-trash').wrap('<a href="' + rvyObjEdit[rvyObjEdit.currentStatus + 'DeletionURL'] + '" style="text-decoration:none"></a>');
}
}

refSelector = null;
Expand Down
Loading

0 comments on commit 4def8d2

Please sign in to comment.