Making WordPress.org

Changeset 9086


Ignore:
Timestamp:
07/30/2019 09:11:33 AM (5 years ago)
Author:
dd32
Message:

Theme Directory: When a theme update older than two years is uploaded, do not auto-approve the Trac ticket.

Previously the Theme Directory was incorrectly applying the 2 year cutoff to the query that the Trac Sync uses, seemingly by accident as as it was coded all updates should've been auto-approved.

Now theme updates older than two years will not have their Trac ticket auto-closed as live, and theme reviewers can review the open theme update tickets, mark as live on Trac, and have the Trac sync mark the version as live in WordPress.

See #4634.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

    r8794 r9086  
    774774            ) );
    775775
    776             // Theme review team auto-approves theme-updates, so mark the theme as live immediately, without sending additional email
     776            $theme_is_older_than_two_years = strtotime( $this->theme_post->post_modified ) < strtotime( '-2 years' );
     777
     778            // Theme review team auto-approves theme-updates, so mark the theme as live immediately, if last updated within two years.
    777779            // Note that this only applies to new ticket creation, so it won't happen on themes with existing outstanding tickets
    778             if ( $this->trac_ticket->priority == 'theme update' ) {
     780            if ( ! $theme_is_older_than_two_years && $this->trac_ticket->priority == 'theme update' ) {
    779781                $this->trac->ticket_update( $ticket_id, 'Theme Update for existing Live theme - automatically reviewed', array( 'action' => 'review' ), false );
    780782                $this->trac->ticket_update( $ticket_id, 'Theme Update for existing Live theme - automatically approved', array( 'action' => 'approve_and_live' ), false );
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/jobs/class-trac-sync.php

    r6295 r9086  
    114114            'posts_per_page' => - 1,
    115115            'meta_query'     => [
    116                 [
     116                'trac_sync_ticket_id' => [
    117117                    'value'   => $ticket_id,
    118118                    'compare' => 'IN',
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/query-modifications.php

    r2920 r9086  
    108108    }
    109109
    110     // Unless a specific theme, or author is being requested, limit results to the last 2 years.
    111     if ( empty( $query->query_vars['name'] ) && empty( $query->query_vars['author_name'] ) && ! in_array( $query->query_vars['browse'], array( 'favorites', 'new', 'updated' ) ) ) {
     110    // Unless a specific theme/author is being requested, or it's an internal query, limit results to the last 2 years.
     111    if (
     112        empty( $query->query_vars['name'] ) &&
     113        empty( $query->query_vars['author_name'] ) &&
     114        ! in_array( $query->query_vars['browse'], array( 'favorites', 'new', 'updated' ) ) &&
     115        empty( $query->query_vars['meta_query']['trac_sync_ticket_id'] ) // jobs/class-trac-sync.php - Always needs to find the post, and looks up via a meta search.
     116    ) {
    112117        $query->query_vars['date_query']['recent_themes_only'] = array(
    113118            'column' => 'post_modified',
     
    117122
    118123    // Prioritize translated themes for localized requests, except when viewing a specific ordered themes.
    119     if ( 'en_US' !== get_locale() && ! in_array( $query->query_vars['browse'], array( 'favorites', 'new', 'updated' ) )  ) {
     124    if (
     125        'en_US' !== get_locale() &&
     126        ! in_array( $query->query_vars['browse'], array( 'favorites', 'new', 'updated' ) )
     127    ) {
    120128        add_filter( 'posts_clauses', 'wporg_themes_prioritize_translated_posts_clauses' );
    121129    }
Note: See TracChangeset for help on using the changeset viewer.