Making WordPress.org

Changeset 5132


Ignore:
Timestamp:
03/08/2017 07:59:57 PM (8 years ago)
Author:
ocean90
Message:

Translate/Rosetta: Allow Cross-Locale PTEs to reject translations which they have approved.

Props akirk.
See #2000.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/cross-locale-pte.php

    r4929 r5132  
    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( $translation_owner_id ) !== intval( get_current_user_id() ) ) {
    304305                return 'waiting';
    305306            }
     
    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.
    406                 return $current_translation_by_user[ $cache_key ] = false;
     405            if ( $current_translation ) {
     406                $translation_owner_id = $current_translation->user_id_last_modified ?: $current_translation->user_id;
     407                if ( intval( $translation_owner_id ) !== $args['user']->ID ) {
     408                    // Current translation was approved by someone else. Disallow setting to current.
     409                    return $current_translation_by_user[ $cache_key ] = false;
     410                }
    407411            }
    408412
Note: See TracChangeset for help on using the changeset viewer.