WordPress.org

Making WordPress.org

Changeset 1965


Ignore:
Timestamp:
10/11/2015 09:38:57 PM (4 years ago)
Author:
nacin
Message:

Trac Notifications: Return a list of component maintainers as stored in WP back to Trac.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-components.php

    r1868 r1965  
    633633        }
    634634
    635         $maintainers = get_post_meta( $post->ID, '_active_maintainers', true );
    636         $maintainers = array_filter( array_map( 'trim', explode( ',', $maintainers ) ) );
     635        $maintainers = $this->get_maintainers_by_post( $post->ID );
    637636        echo '<td class="no-grav maintainers">';
    638637        foreach ( $maintainers as $maintainer ) {
     
    642641        echo '</tr>';
    643642    }
     643
     644    function get_maintainers_by_post( $post_id ) {
     645        return array_filter( array_map( 'trim', explode( ',', get_post_meta( $post_id, '_active_maintainers', true ) ) ) );
     646    }
     647
     648    function get_maintainers_by_component( $component ) {
     649        return $this->get_maintainers_by_post( get_page_by_title( $component, OBJECT, 'component' )->ID );
     650    }
    644651}
    645 new Make_Core_Trac_Components;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php

    r1917 r1965  
    99
    1010    protected $trac_subdomain;
     11    protected $components;
    1112
    1213    protected $tracs_supported = array( 'core', 'meta', 'themes', 'plugins' );
     
    2829        if ( 'core' === $trac ) {
    2930            require __DIR__ . '/trac-components.php';
     31            $this->components = new Make_Core_Trac_Components;
    3032        }
    3133    }
     
    364366    <?php
    365367        $this->ticket_notes( $ticket, $username );
    366         wp_send_json_success( array( 'notifications-box' => ob_get_clean() ) );
     368        $send = array( 'notifications-box' => ob_get_clean() );
     369        if ( isset( $this->components ) ) {
     370            $send['maintainers'] = $this->components->get_maintainers_by_component( $ticket->component );
     371        }
     372        wp_send_json_success( $send );
    367373        exit;
    368374    }
Note: See TracChangeset for help on using the changeset viewer.