Skip to content

Commit

Permalink
Merge pull request #1204 from publishpress/release-3.5.8
Browse files Browse the repository at this point in the history
Release 3.5.8
  • Loading branch information
agapetry authored Apr 16, 2024
2 parents 18060a2 + 0a2c425 commit 6f8cad6
Show file tree
Hide file tree
Showing 25 changed files with 897 additions and 659 deletions.
2 changes: 0 additions & 2 deletions admin/admin-init_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ function rvy_admin_init() {
$doaction = (!empty($_REQUEST['action']) && !is_numeric($_REQUEST['action'])) ? sanitize_key($_REQUEST['action']) : sanitize_key($_REQUEST['action2']);

if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], ['decline_revision'])) {
check_admin_referer('decline-revision');
} else {
check_admin_referer('bulk-revision-queue');
}

Expand Down
30 changes: 28 additions & 2 deletions admin/class-list-table_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,42 @@ public function __construct($args = []) {
}

// Gutenberg will not allow immediate deletion of revisions from within editor

// Ensure deletion of trashed revisions through redundant triggering:
// * Revision and Post IDs stored to options array on trashed_post action
// * Revision IDs in redirect URL

if ($triggered_deletions = (array) get_option('_rvy_trigger_deletion')) {
$clear_trigger_option = true;
}
if (!empty($_REQUEST['pp_revisions_deleted'])) {
global $current_user;

$delete_id = (int) $_REQUEST['pp_revisions_deleted'];

if (('trash' == get_post_field('post_status', $delete_id)) && (get_post_field('post_author', $delete_id) == $current_user->ID)) {
wp_delete_post($delete_id, true);
if (('trash' == get_post_field('post_status', $delete_id))) {
$revision = get_post($delete_id);

if (!empty($revision->comment_count)) {
$triggered_deletions[$delete_id] = $revision->comment_count;
}
}
}

foreach ($triggered_deletions as $revision_id => $post_id) {
if ($revision_id) {
wp_delete_post($revision_id, true);
}

if ($post_id) {
revisionary_refresh_postmeta($post_id);
}
}

if ($clear_trigger_option) {
delete_option('_rvy_trigger_deletion');
}

$this->correctCommentCounts();

if (!defined('REVISIONARY_DISABLE_WP_CRON_RESTORATION') && rvy_get_option('scheduled_revisions') && rvy_get_option('scheduled_publish_cron')) {
Expand Down
2 changes: 1 addition & 1 deletion admin/edit-revision-ui_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function add_js() {
padding-left: 20px;
}

button.edit-post-post-visibility__toggle, div.editor-post-url__panel-dropdown, div.components-checkbox-control {
button.edit-post-post-visibility__toggle, div.editor-post-url__panel-dropdown, div.edit-post-post-status div.components-checkbox-control {
display: none;
}
<?php else:?>
Expand Down
9 changes: 8 additions & 1 deletion admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function options_ui( $sitewide = false, $customize_defaults = false ) {
'revision_preview_links' => esc_html__('Show Preview Links', 'revisionary'),
'preview_link_type' => esc_html__('Preview Link Type', 'revisionary'),
'preview_link_alternate_preview_arg' => esc_html__('Modify preview link for better theme compatibility', 'revisionary'),
'block_editor_extra_preview_button' => esc_html__('Extra preview button in Gutenberg Editor top bar', 'revisionary'),
'home_preview_set_home_flag' => esc_html__('Theme Compat: For front page revision preview, set home flag', 'revisionary'),
'compare_revisions_direct_approval' => esc_html__('Approve Button on Compare Revisions screen', 'revisionary'),
'copy_revision_comments_to_post' => esc_html__('Copy revision comments to published post', 'revisionary'),
Expand Down Expand Up @@ -182,7 +183,7 @@ function options_ui( $sitewide = false, $customize_defaults = false ) {
'scheduled_revisions' => ['scheduled_revisions', 'scheduled_publish_cron', 'async_scheduled_publish', 'wp_cron_usage_detected', 'scheduled_revision_update_post_date', 'scheduled_revision_update_modified_date'],
'pending_revisions' => ['pending_revisions', 'revise_posts_capability', 'pending_revision_update_post_date', 'pending_revision_update_modified_date'],
'revision_queue' => ['revisor_lock_others_revisions', 'revisor_hide_others_revisions', 'admin_revisions_to_own_posts', 'list_unsubmitted_revisions'],
'preview' => ['revision_preview_links', 'preview_link_type', 'preview_link_alternate_preview_arg', 'home_preview_set_home_flag', 'compare_revisions_direct_approval'],
'preview' => ['revision_preview_links', 'preview_link_type', 'preview_link_alternate_preview_arg', 'home_preview_set_home_flag', 'compare_revisions_direct_approval', 'block_editor_extra_preview_button'],
'revisions' => ['trigger_post_update_actions', 'copy_revision_comments_to_post', 'diff_display_strip_tags', 'past_revisions_order_by', 'rev_publication_delete_ed_comments', 'deletion_queue', 'revision_archive_deletion', 'revision_restore_require_cap', 'display_hints'],
'notification' => ['pending_rev_notify_admin', 'pending_rev_notify_author', 'revision_update_notifications', 'rev_approval_notify_admin', 'rev_approval_notify_author', 'rev_approval_notify_revisor', 'publish_scheduled_notify_admin', 'publish_scheduled_notify_author', 'publish_scheduled_notify_revisor', 'use_notification_buffer'],
]
Expand Down Expand Up @@ -709,6 +710,12 @@ function options_ui( $sitewide = false, $customize_defaults = false ) {
$hint = esc_html__('If disabled, Compare screen links to Revision Preview for approval.', 'revisionary');
$this->option_checkbox( 'compare_revisions_direct_approval', $tab, $section, $hint, '' );
?>
<br />

<?php
$hint = '';
$this->option_checkbox( 'block_editor_extra_preview_button', $tab, $section, $hint, '' );
?>
</td></tr></table>
<?php endif; // any options accessable in this section

Expand Down
13 changes: 10 additions & 3 deletions admin/post-editor-workflow-ui_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static function revisionLinkParams($args = []) {
];

$vars['disableRecaption'] = version_compare($wp_version, '5.9-beta', '>=') || is_plugin_active('gutenberg/gutenberg.php');
$vars['viewTitle'] = '';
$vars['viewTitleExtra'] = '';

if (rvy_get_option('revision_preview_links') || current_user_can('administrator') || is_super_admin()) {
Expand All @@ -54,15 +55,21 @@ public static function revisionLinkParams($args = []) {
$vars['viewCaption'] = ('future-revision' == $post->post_mime_type) ? esc_html__('View / Publish', 'revisionary') : esc_html__('View / Approve', 'revisionary');
}

if (rvy_get_option('block_editor_extra_preview_button')) {
$vars['viewTitleExtra'] = esc_html__('View saved revision', 'revisionary');
}

$vars['viewTitle'] = esc_html__('View / Moderate saved revision', 'revisionary');
} else {
$vars['viewCaption'] = version_compare($wp_version, '5.5-beta', '>=') ? esc_html__('Preview / Submit') : esc_html__('View / Submit');

if (rvy_get_option('block_editor_extra_preview_button')) {
$vars['viewTitleExtra'] = esc_html__('View saved revision', 'revisionary');
}

$vars['viewTitle'] = esc_html__('View / Submit saved revision', 'revisionary');
}

if (defined('RVY_EXTRA_VIEW_BUTTON')) {
$vars['viewTitleExtra'] = $vars['viewTitle'];
}
} else {
$vars['viewURL'] = '';
$vars['viewCaption'] = '';
Expand Down
8 changes: 7 additions & 1 deletion admin/rvy_post-block-edit.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ jQuery(document).ready( function($) {

html += '</div>';

$('div.edit-post-post-schedule').after(html);
var elem = $('div.editor-post-schedule__panel-dropdown').closest('div.editor-post-panel__row');

if (!$(elem).length) {
elem = $('div.edit-post-post-schedule');
}

$(elem).first().after(html);

if (rvyCreationDisabled) {
$('button.revision-approve').prop('disabled', 'disabled');
Expand Down
3 changes: 2 additions & 1 deletion admin/rvy_post-block-edit.js

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

74 changes: 24 additions & 50 deletions admin/rvy_revision-block-edit.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,63 +368,37 @@ jQuery(document).ready(function ($) {
$('button.editor-post-save-draft:not(.rvy-recaption)').addClass('rvy-recaption').removeClass('is-tertiary').addClass('is-primary').addClass('ppr-purple-button');
}

var newPreviewItem = '';

if (rvyObjEdit.viewTitleExtra) {
newPreviewItem = '<div class="components-menu-group"><div role="group"><div class="edit-post-header-preview__grouping-external">'
+ '<a href="' + rvyObjEdit.viewURL + '" target="pp_revisions_copy" role="menuitem" class="ppr-purple-button components-button is-primary edit-post-header-preview__button-external">'
+ rvyObjEdit.viewTitle + '</a></div></div></div>';

if (rvyObjEdit.viewTitleExtra && !$('div.rvy-revision-preview').length) {
if (rvyObjEdit.viewTitleExtra) {
$('div.block-editor-post-preview__dropdown').after(newPreviewItem).addClass('rvy-revision-preview');
if (rvyObjEdit.viewURL && ($('.editor-preview-dropdown__toggle').length || $('div.block-editor-post-preview__dropdown').length)) {
var viewPreviewLink = '<a href="'
+ rvyObjEdit.viewURL
+ '" target="pp_revisions_copy" role="menuitem" class="ppr-purple-button components-button is-primary editor-preview-dropdown__button-external">'
+ rvyObjEdit.viewTitle
+ '</a>';

if (rvyObjEdit.viewTitleExtra && !$('.rvy-revision-preview').length) {
if ($('.editor-preview-dropdown__toggle').length) {
$('.editor-preview-dropdown__toggle').after('<button class="components-button rvy-revision-preview" type="button">' + viewPreviewLink + '</button>');
} else {
$('div.block-editor-post-preview__dropdown').after('<div><button class="components-button rvy-revision-preview" type="button">' + viewPreviewLink + '</button></div>');
}

$('button.rvy-revision-preview a.ppr-purple-button').html(rvyObjEdit.viewTitleExtra);
}
}

if (($('div.edit-post-header__settings a.editor-post-preview:visible').length || $('div.block-editor-post-preview__dropdown button.block-editor-post-preview__button-toggle:visible').length) && !$('a.rvy-post-preview').length) {
if (rvyObjEdit.viewURL && $('.block-editor-post-preview__button-toggle').length) {
if ($('div.edit-post-header-preview__grouping-external').length == 1) {
//var elemTemp = $('div.edit-post-header-preview__grouping-external a svg').clone();

//if (typeof elemTemp[0] != 'undefined') {
//var svgElem = elemTemp[0].outerHTML;

if ($('div.edit-post-header-preview__grouping-external a svg').length) {
$('div.edit-post-header-preview__grouping-external').after(newPreviewItem);
}
}

if (rvyObjEdit.viewCaption) {
RvyRecaptionElement('.block-editor-post-preview__button-toggle', rvyObjEdit.viewCaption);
$('button.block-editor-post-preview__button-toggle:not(.ppr-purple-button)').removeClass('is-tertiary').addClass('is-secondary').addClass('ppr-purple-button');
if (!$('div.components-menu-group div a.ppr-purple-button').length) {
if ($('.editor-preview-dropdown__button-external svg').length) {
$('.editor-preview-dropdown__button-external:not(.ppr-purple-button)').closest('div.components-dropdown-menu__menu').after('<div class="components-menu-group"><div role="group">' + viewPreviewLink + '</div></div>');
}
}
if (rvyObjEdit.viewTitle) {
$('div.edit-post-header__settings a.rvy-post-preview').attr('title', rvyObjEdit.viewTitle);

if (rvyObjEdit.viewCaption) {
RvyRecaptionElement('.editor-preview-dropdown__toggle', rvyObjEdit.viewCaption);
$('.editor-preview-dropdown__toggle:not(.ppr-purple-button)').removeClass('is-tertiary').addClass('is-secondary').addClass('ppr-purple-button');
}

} else {
if (!rvyObjEdit.multiPreviewActive) { // WP < 5.5
if (!$('a.editor-post-preview').next('a.rvy-post-preview').length) {
var original = $('div.edit-post-header__settings a.editor-post-preview');
$(original).after(original.clone().attr('href', rvyObjEdit.viewURL).attr('target', '_blank').removeClass('editor-post-preview').addClass('rvy-post-preview').css('margin', '0 10px 0 10px'));

if (rvyObjEdit.viewCaption) {
RvyRecaptionElement('div.edit-post-header__settings a.rvy-post-preview', rvyObjEdit.viewCaption);
}

if (rvyObjEdit.viewTitle) {
$('div.edit-post-header__settings a.rvy-post-preview').attr('title', rvyObjEdit.viewTitle);
}

original = null;
}
}

if (rvyObjEdit.previewTitle && !$('a.editor-post-preview').attr('title')) {
$('div.edit-post-header__settings a.editor-post-preview').attr('title', rvyObjEdit.previewTitle);
}
}
if (rvyObjEdit.viewTitle) {
$('div.edit-post-header__settings a.rvy-post-preview').attr('title', rvyObjEdit.viewTitle);
}

if (rvyObjEdit.revisionEdits && $('div.edit-post-sidebar a.editor-post-last-revision__title:visible').length && !$('div.edit-post-sidebar a.editor-post-last-revision__title.rvy-recaption').length) {
Expand Down
Loading

0 comments on commit 6f8cad6

Please sign in to comment.