WordPress.org

Making WordPress.org

Ticket #2000: 2000.5.diff

File 2000.5.diff, 1.8 KB (added by akirk, 5 years ago)
  • global.wordpress.org/public_html/wp-content/mu-plugins/roles/cross-locale-pte.php

     
    299299                }
    300300
    301301                if ( GP::$permission->current_user_can( 'cross-pte', 'translation-set', $old_translation->translation_set_id ) ) {
    302                         // Set to waiting if a current translation exists by another user.
    303                         if ( intval( $old_translation->user_id ) !== intval( get_current_user_id() ) ) {
     302                        // Set to waiting if a current translation exists that was approved by another user.
     303                        $translation_owner_id = $old_translation->user_id_last_modified ?: $old_translation->user_id;
     304                        if ( intval( $old_translation->translation_owner_id ) !== intval( get_current_user_id() ) ) {
    304305                                return 'waiting';
    305306                        }
    306307                }
     
    401402
    402403                if ( GP::$permission->user_can( $args['user'], 'cross-pte', 'translation-set', $translation->translation_set_id ) ) {
    403404                        $current_translation = GP::$translation->find_one( array( 'translation_set_id' => $translation->translation_set_id, 'original_id' => $translation->original_id, 'status' => 'current' ) );
    404                         if ( $current_translation && intval( $current_translation->user_id ) !== $args['user']->ID ) {
    405                                 // Current translation was authored by someone else. Disallow setting to current.
     405                        $translation_owner_id = $current_translation->user_id_last_modified ?: $current_translation->user_id;
     406                        if ( $current_translation && intval( $translation_owner_id ) !== $args['user']->ID ) {
     407                                // Current translation was approved by someone else. Disallow setting to current.
    406408                                return $current_translation_by_user[ $cache_key ] = false;
    407409                        }
    408410