Skip to content

Commit

Permalink
Merge pull request #273 from publishpress/release/2.4.5
Browse files Browse the repository at this point in the history
Release/2.4.5
  • Loading branch information
agapetry authored Nov 30, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 219edca + 7b2f635 commit 4810b13
Showing 14 changed files with 595 additions and 560 deletions.
51 changes: 33 additions & 18 deletions admin/class-list-table_rvy.php
Original file line number Diff line number Diff line change
@@ -75,12 +75,14 @@ function do_query( $q = false ) {
$qp['author'] = $q['post_author'];
}

$filter_name = (defined('REVISIONARY_QUEUE_LEGACY_FILTER')) ? 'posts_clauses' : 'posts_clauses_request';

do_action('revisionary_queue_pre_query');
add_filter('posts_clauses', [$this, 'pre_query_filter'], 5, 2);
add_filter('posts_clauses', [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);
add_filter($filter_name, [$this, 'pre_query_filter'], 5, 2);
add_filter($filter_name, [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);
$pre_query = new WP_Query( $qp );
remove_filter('posts_clauses', [$this, 'pre_query_filter'], 5, 2);
remove_filter('posts_clauses', [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);
remove_filter($filter_name, [$this, 'pre_query_filter'], 5, 2);
remove_filter($filter_name, [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);
do_action('revisionary_queue_pre_query_done');

$this->published_post_ids = $pre_query->posts;
@@ -140,9 +142,11 @@ function do_query( $q = false ) {

global $wp_query;

$filter_name = (defined('REVISIONARY_QUEUE_LEGACY_FILTER')) ? 'posts_clauses' : 'posts_clauses_request';

add_filter('presspermit_posts_clauses_intercept', [$this, 'flt_presspermit_posts_clauses_intercept'], 10, 4);
add_filter('posts_clauses', [$this, 'revisions_filter'], 5, 2);
add_filter('posts_clauses', [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);
add_filter($filter_name, [$this, 'revisions_filter'], 5, 2);
add_filter($filter_name, [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);

if (defined('PUBLISHPRESS_MULTIPLE_AUTHORS_VERSION')) {
remove_action('pre_get_posts', ['MultipleAuthors\\Classes\\Query', 'action_pre_get_posts']);
@@ -162,8 +166,8 @@ function do_query( $q = false ) {
//echo($wp_query->request);

remove_filter('presspermit_posts_clauses_intercept', [$this, 'flt_presspermit_posts_clauses_intercept'], 10, 4);
remove_filter('posts_clauses', [$this, 'revisions_filter'], 5, 2);
remove_filter('posts_clauses', [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);
remove_filter($filter_name, [$this, 'revisions_filter'], 5, 2);
remove_filter($filter_name, [$this, 'restore_revisions_filter'], PHP_INT_MAX - 1, 2);

return $qr['post_status'];
}
@@ -228,7 +232,7 @@ function revisions_where_filter($where, $args = []) {
? "OR ($p.post_status = 'pending-revision' AND $p.post_author = '$current_user->ID')"
: '';

$where .= " AND ($p.comment_count IN ($post_id_csv) $own_revision_clause)";
$where_append = "($p.comment_count IN ($post_id_csv) $own_revision_clause)";

if (rvy_get_option('revisor_hide_others_revisions') && !current_user_can('administrator')
&& !current_user_can('list_others_revisions') && empty($args['suppress_author_clause'])
@@ -261,18 +265,20 @@ function revisions_where_filter($where, $args = []) {
$type_clause = '';
}

$where .= $wpdb->prepare(" AND ($p.post_author = %d $type_clause)", $current_user->ID );
$where_append .= $wpdb->prepare(" AND ($p.post_author = %d $type_clause)", $current_user->ID );
} elseif ($revisionary->config_loaded) {
$where .= (array_filter($revisionary->enabled_post_types))
$where_append .= (array_filter($revisionary->enabled_post_types))
? " AND ($p.post_type IN ('" . implode("','", array_keys(array_filter($revisionary->enabled_post_types))) . "'))"
: "AND 1=2";
}

if (empty($args['suppress_author_clause'])) {
$status_csv = "'" . implode("','", rvy_filtered_statuses()) . "'";
$where .= " AND $p.comment_count IN (SELECT ID FROM $wpdb->posts WHERE post_status IN ($status_csv))";
$where_append .= " AND $p.comment_count IN (SELECT ID FROM $wpdb->posts WHERE post_status IN ($status_csv))";
}

$where .= " AND $where_append";

return $where;
}

@@ -319,10 +325,12 @@ function rvy_pending_custom_col( $column_name, $post_id ) {
if ( ! $post = get_post( $post_id ) )
return;

$request_url = add_query_arg($_REQUEST, admin_url('admin.php?page=revisionary-q'));

switch ($column_name) {
case 'post_type':
if ( $type_obj = get_post_type_object( get_post_field( 'post_type', $post->post_parent ) ) ) {
$link = add_query_arg( 'post_type', $type_obj->name, esc_url($_SERVER['REQUEST_URI']) );
$link = add_query_arg('post_type', $type_obj->name, $request_url);
echo "<a href='$link'>{$type_obj->labels->singular_name}</a>";
}

@@ -344,7 +352,7 @@ function rvy_pending_custom_col( $column_name, $post_id ) {
$label = ucwords($post->post_status);
}

$link = add_query_arg( 'post_status', $post->post_status, esc_url($_SERVER['REQUEST_URI']) );
$link = add_query_arg('post_status', $post->post_status, $request_url);
echo "<a href='$link'>$label</a>";

break;
@@ -413,7 +421,7 @@ function rvy_pending_custom_col( $column_name, $post_id ) {
$authors_str = [];
foreach ($authors as $author) {
if (is_object($author)) {
$url = add_query_arg('post_author', $author->ID, esc_url($_SERVER['REQUEST_URI']));
$url = add_query_arg('post_author', $author->ID, $request_url);
$authors_str[] = '<a href="' . $url . '">' . esc_html($author->display_name) . '</a>';
}
}
@@ -426,7 +434,7 @@ function rvy_pending_custom_col( $column_name, $post_id ) {
echo implode(', ', $authors_str);
} else {
$author_caption = get_the_author_meta('display_name', $parent_post->post_author);
echo $this->apply_edit_link(add_query_arg('post_author', $parent_post->post_author, esc_url($_SERVER['REQUEST_URI'])), $author_caption);
echo $this->apply_edit_link(add_query_arg('post_author', $parent_post->post_author, $request_url), $author_caption);
}
} // end switch
}
@@ -452,9 +460,12 @@ protected function handle_published_row_actions( $post, $column_name ) {
);
}

$request_url = add_query_arg($_REQUEST, admin_url('admin.php?page=revisionary-q'));

$actions['list_filter'] = sprintf(
'<a href="%1$s" title="%2$s" aria-label="%2$s">%3$s</a>',
add_query_arg('published_post', $post->ID, esc_url($_SERVER['REQUEST_URI'])),

add_query_arg('published_post', $post->ID, $request_url),
/* translators: %s: post title */
esc_attr( sprintf( __( 'View only revisions of %s', 'revisionary' ), '&#8220;' . $post->post_title . '&#8221;' ) ),
__( 'Filter' )
@@ -1023,8 +1034,10 @@ public function column_author( $post ) {
//if (defined('PUBLISHPRESS_MULTIPLE_AUTHORS_VERSION')) {
// do_action("manage_{$post->post_type}_posts_custom_column", 'authors', $post->ID);
//} else {
$request_url = add_query_arg($_REQUEST, admin_url('admin.php?page=revisionary-q'));

$args = ['author' => get_the_author_meta( 'ID' )];
echo $this->apply_edit_link( add_query_arg('author', $args['author'], esc_url($_SERVER['REQUEST_URI'])), get_the_author() );
echo $this->apply_edit_link( add_query_arg('author', $args['author'], $request_url), get_the_author() );
//}
}

@@ -1123,6 +1136,8 @@ protected function display_tablenav( $which ) {
<?php
endif;
$this->extra_tablenav( $which );

$_SERVER['REQUEST_URI'] = str_replace('#038;', '&', $_SERVER['REQUEST_URI']);
$this->pagination( $which );
?>

1 change: 1 addition & 0 deletions admin/post-edit-block-ui_rvy.php
Original file line number Diff line number Diff line change
@@ -160,6 +160,7 @@ public static function act_object_guten_scripts() {
// clear scheduled revision redirect flag
delete_post_meta( $post_id, "_new_scheduled_revision_{$current_user->ID}" );
delete_post_meta( $post_id, "_save_as_revision_{$current_user->ID}" );
update_postmeta_cache($post_id);

} elseif($do_pending_revisions) {
//div.editor-post-publish-panel button.editor-post-publish-button
1 change: 1 addition & 0 deletions admin/post-edit_rvy.php
Original file line number Diff line number Diff line change
@@ -169,6 +169,7 @@ function act_admin_head() {
);

delete_post_meta( $post->ID, "_save_as_revision_{$current_user->ID}" );
update_postmeta_cache($post->ID);
}

function limitRevisionEditorUI() {
9 changes: 6 additions & 3 deletions admin/revision-ui_rvy.php
Original file line number Diff line number Diff line change
@@ -86,7 +86,8 @@ function rvy_metabox_notification_list() {
}
}

$default_ids = $publisher_ids;
// boolean array with user IDs as array keys
$default_ids = apply_filters('revisionary_notify_publisher_default_ids', $publisher_ids, $object_id);
}

if ( '1' === $notify_author ) {
@@ -128,9 +129,11 @@ function rvy_metabox_notification_list() {

echo("<div id='rvy_cclist_$topic'>");

if ( $default_ids )
if ( $default_ids ) {
// array of WP_User objects
$post_publishers = apply_filters('revisionary_notify_publishers_eligible', $post_publishers, $object_id);
RevisionaryAgentsChecklist::agents_checklist( 'user', $post_publishers, $id_prefix, $default_ids );
else {
} else {
if ( ( 'always' === $notify_editors ) && $publisher_ids )
_e( 'Publishers will be notified (but cannot be selected here).', 'revisionary' );
else
2 changes: 1 addition & 1 deletion admin/rvy_post-block-edit-revisor.dev.js
Original file line number Diff line number Diff line change
@@ -158,7 +158,7 @@ jQuery(document).ready( function($) {
$(ediv + 'button.editor-post-trash').hide();
$(ediv + 'button.editor-post-switch-to-draft').hide();
$(ediv + 'div.components-notice-list').hide(); // autosave notice
$(ediv + 'div.edit-post-post-status div.components-base-control__field input[type="checkbox"]').hide().next('label').hide();
$(ediv + 'div.edit-post-post-status div.components-base-control__field input[type="checkbox"]').each(function(e){$('label[for="' + $(this).attr('id') + '"]').hide();}).hide().next('label').hide();
}

}
2 changes: 1 addition & 1 deletion admin/rvy_post-block-edit-revisor.js

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

4 changes: 2 additions & 2 deletions admin/rvy_revision-block-edit.dev.js
Original file line number Diff line number Diff line change
@@ -171,8 +171,8 @@ jQuery(document).ready( function($) {
$('button.editor-post-publish-button').hide();
}

if (rvyObjEdit.approvalURL && !RvyApprovalHidden && !$('button.revision-approve').length && $('button.editor-post-trash').filter(':visible').length) {
$('button.editor-post-trash').before(
if (rvyObjEdit.approvalURL && !RvyApprovalHidden && !$('button.revision-approve').length && $('div.edit-post-post-schedule').length) {
$('div.edit-post-post-schedule').after(
'<a href="' + rvyObjEdit.approvalURL + '" class="revision-approve" title="' + rvyObjEdit.approvalTitle + '"><button type="button" class="components-button revision-approve is-button is-default is-large">' + rvyObjEdit.approvalCaption + '</button></a>');

if (rvyObjEdit.deletionURL) {
2 changes: 1 addition & 1 deletion admin/rvy_revision-block-edit.js

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

Loading

0 comments on commit 4810b13

Please sign in to comment.