Skip to content

Commit

Permalink
Merge pull request #307 from publishpress/release/2.4.8
Browse files Browse the repository at this point in the history
Release/2.4.8
  • Loading branch information
agapetry authored Dec 19, 2020
2 parents ae8fe68 + 3b39974 commit bc0df5a
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 10 deletions.
35 changes: 31 additions & 4 deletions admin/class-list-table_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,30 @@ function pre_query_filter($clauses, $_wp_query = false) {
return $clauses;
}

function append_revisions_where($where, $args=[]) {
global $wpdb;

$where_append = '';

if (defined('ICL_SITEPRESS_VERSION')) {
if (!empty($_REQUEST['lang'])) {
$lang = $_REQUEST['lang'];
} else {
global $sitepress;
if (!empty($sitepress) && method_exists($sitepress, 'get_admin_language_cookie')) {
$lang = $sitepress->get_admin_language_cookie();
}
}

if ($lang) {
$p = (!empty($args['alias'])) ? $args['alias'] : $wpdb->posts;
$where_append = " AND $p.comment_count IN (SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE element_type LIKE 'post_%' AND language_code = '$lang')";
}
}

return $where_append;
}

function revisions_where_filter($where, $args = []) {
global $wpdb, $current_user, $revisionary;

Expand All @@ -233,9 +257,12 @@ function revisions_where_filter($where, $args = []) {
$post_id_csv = "'" . implode("','", $this->published_post_ids) . "'";
}

$own_revision_clause = (empty($_REQUEST['post_author']) || !empty($args['status_count'])) && empty($_REQUEST['published_post'])
? "OR ($p.post_status = 'pending-revision' AND $p.post_author = '$current_user->ID')"
: '';
if ((empty($_REQUEST['post_author']) || !empty($args['status_count'])) && empty($_REQUEST['published_post'])) {
$own_revision_and = $this->append_revisions_where($where, $args);
$own_revision_clause = "OR ($p.post_status = 'pending-revision' AND $p.post_author = '$current_user->ID'{$own_revision_and})";
} else {
$own_revision_clause = '';
}

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

Expand Down Expand Up @@ -296,7 +323,7 @@ function revisions_filter($clauses, $_wp_query = false) {
function rvy_pending_list_register_columns( $columns ) {
global $wp_query;
foreach( $wp_query->posts as $post ) {
if ( ('future-revision' == $post->post_status) || (strtotime($post->post_date_gmt) > agp_time_gmt()) ) {
if ( !empty($post) && is_object($post) && (('future-revision' == $post->post_status) || (strtotime($post->post_date_gmt) > agp_time_gmt())) ) {
$have_scheduled = true;
break;
}
Expand Down
2 changes: 2 additions & 0 deletions admin/rvy_revision-block-edit.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ jQuery(document).ready( function($) {
}

$(ediv + '#publishpress-notifications').hide();

$('#icl_div').closest('div.edit-post-meta-boxes-area').hide();
}

if ( $('button.editor-post-publish-button').length ) {
Expand Down
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.

8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Tags: revision, submit changes, workflow, collaboration, permissions, moderate,
Requires at least: 4.9.7
Requires PHP: 5.6.20
Tested up to: 5.6
Stable tag: 2.4.7
Stable tag: 2.4.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -100,6 +100,12 @@ Follow PublishPress on [Facebook](https://www.facebook.com/publishpress), [Twitt

== Changelog ==

= 2.4.8 - 17 Dec 2020 =
* Compat : WPML - Revision Queue was not filtered by WPML language selector
* Compat : WPML - Hide non-revisionable Languages settings in Revision editor
* Compat : TablePress - Tables could not be updated by non-Administrators
* Fixed : Revision Queue - PHP Notice if no revisions listed

= 2.4.7 - 15 Dec 2020 =
* Fixed : WP 5.6 - Pending Revision submission failed (since 2.4.6)
* Fixed : Compare Pending Revisions always credited assigned post author for Current Revision, now shows user who created the last published update. To revert to previous behavior, define constant RVY_LEGACY_COMPARE_REVISIONS_AUTHOR_DISPLAY.
Expand Down
16 changes: 16 additions & 0 deletions revision-creation_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function flt_maybe_insert_revision($data, $postarr) {
return $data;
}

if (!empty($postarr['post_type']) && empty($revisionary->enabled_post_types[$postarr['post_type']])) {
return $data;
}

// todo: consolidate functions
$this->flt_pendingrev_post_status($data['post_status']);

Expand Down Expand Up @@ -113,6 +117,10 @@ function flt_pendingrev_post_status($status) {
}

if ( ! empty( $post_type ) ) {
if (empty($revisionary->enabled_post_types[$post_type])) {
return $status;
}

if ( $type_obj = get_post_type_object( $post_type ) ) {
if ( ! agp_user_can( $type_obj->cap->edit_post, $post_id, '', array( 'skip_revision_allowance' => true ) ) ) {
$revisionary->impose_pending_rev[$post_id] = true;
Expand All @@ -137,6 +145,10 @@ function flt_pending_revision_data( $data, $postarr ) {
return $data;
}

if (!empty($postarr['post_type']) && empty($revisionary->enabled_post_types[$postarr['post_type']])) {
return $data;
}

if (!empty($pagenow) && ('post.php' == $pagenow)) {
if (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], ['delete', 'trash'])) {
return $data;
Expand Down Expand Up @@ -423,6 +435,10 @@ function flt_create_scheduled_rev( $data, $post_arr ) {
if ( empty( $post_arr['ID'] ) ) {
return $data;
}

if (!empty($post_arr['post_type']) && empty($revisionary->enabled_post_types[$post_arr['post_type']])) {
return $data;
}

if ( ! $published_post = get_post( $post_arr['ID'] ) ) {
return $data;
Expand Down
6 changes: 3 additions & 3 deletions revisionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Maintain published content with teamwork and precision using the Revisions model to submit, approve and schedule changes.
* Author: PublishPress
* Author URI: https://publishpress.com
* Version: 2.4.7
* Version: 2.4.8
* Text Domain: revisionary
* Domain Path: /languages/
* Min WP Version: 4.9.7
Expand Down Expand Up @@ -96,7 +96,7 @@ function($links, $file)
// register these functions before any early exits so normal activation/deactivation can still run with RS_DEBUG
register_activation_hook(__FILE__, function()
{
$current_version = '2.4.7';
$current_version = '2.4.8';

$last_ver = get_option('revisionary_last_version');

Expand Down Expand Up @@ -172,7 +172,7 @@ function()
return;
}

define('REVISIONARY_VERSION', '2.4.7');
define('REVISIONARY_VERSION', '2.4.8');

if ( ! defined( 'RVY_VERSION' ) ) {
define( 'RVY_VERSION', REVISIONARY_VERSION ); // back compat
Expand Down
3 changes: 3 additions & 0 deletions revisionary_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ function configurationLateInit() {
private function setPostTypes() {
$this->enabled_post_types = apply_filters(
'revisionary_enabled_post_types',
array_diff_key(
array_merge(
array_fill_keys(
get_post_types(['public' => true]), true
),
['swfd-courses' => true]
),
['tablepress_table' => true]
)
);

Expand Down
6 changes: 5 additions & 1 deletion rvy_init.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ function _rvy_restore_published_content( $post_ID, $post_after, $post_before ) {
}

function _rvy_buffer_post_content($maybe_empty, $postarr) {
global $wpdb, $current_user;
global $wpdb, $current_user, $revisionary;

if (empty($postarr['ID']) || defined('RVY_DISABLE_CONTENT_BUFFER')) {
return $maybe_empty;
}

if (!empty($postarr['post_type']) && $revisionary && empty($revisionary->enabled_post_types[$postarr['post_type']])) {
return $maybe_empty;
}

if ($status_obj = get_post_status_object(get_post_field('post_status', $postarr['ID']))) {
if (!empty($status_obj->public) || !empty($status_obj->private)) {
if (rvy_get_post_meta($postarr['ID'], "_save_as_revision_{$current_user->ID}", true) || !agp_user_can('edit_post', $postarr['ID'], '', ['skip_revision_allowance' => true])) {
Expand Down

0 comments on commit bc0df5a

Please sign in to comment.