Making WordPress.org

Changeset 11668


Ignore:
Timestamp:
03/11/2022 09:41:43 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Make: Enable the Components page for Meta Trac.

See #6182.

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

Legend:

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

    r11373 r11668  
    66    const POST_TYPE_NAME = 'component';
    77
     8    protected $trac;
     9
     10    protected $tracs_supported = array( 'core', 'meta' );
     11
    812    function __construct( $api ) {
    9         $this->api = $api;
     13        $make_site = explode( '/', home_url( '' ) );
     14        $trac = $make_site[3];
     15        if ( $make_site[2] !== 'make.wordpress.org' || ! in_array( $trac, $this->tracs_supported ) ) {
     16            return;
     17        }
     18
     19        $this->trac = $trac;
     20        $this->api  = $api;
     21
    1022        add_action( 'init', array( $this, 'init' ) );
    1123        add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
     
    2032        add_filter( 'wp_nav_menu_objects', array( $this, 'highlight_menu_component_link' ) );
    2133        add_filter( 'map_meta_cap', [ $this, 'map_meta_cap' ], 10, 4 );
     34    }
     35
     36    function trac_url() {
     37        return 'https://' . $this->trac . '.trac.wordpress.org';
     38    }
     39
     40    function trac_name() {
     41        return ucfirst( $this->trac );
    2242    }
    2343
     
    342362        ) );
    343363        if ( $recent_posts->have_posts() ) {
    344             echo "<h3>Recent posts on the make/core blog</h3>\n<ul>";
     364            echo "<h3>Recent posts on the make/{$this->trac} blog</h3>\n<ul>";
    345365            while ( $recent_posts->have_posts() ) {
    346366                $recent_posts->the_post();
     
    404424        }
    405425
    406         echo "\n" . "Many contributors help maintain one or more components. These maintainers are vital to keeping WordPress development running as smoothly as possible. They triage new tickets, look after existing ones, spearhead or mentor tasks, pitch new ideas, curate roadmaps, and provide feedback to other contributors. Longtime maintainers with a deep understanding of particular areas of core are always seeking to mentor others to impart their knowledge.\n\n";
    407         echo "<strong>Want to help? Start following this component!</strong> <a href='/core/notifications/'>Adjust your notifications here</a>. Feel free to dig into any ticket." . "\n\n";
     426        echo "\n" . "Many contributors help maintain one or more components. These maintainers are vital to keeping WordPress development running as smoothly as possible. They triage new tickets, look after existing ones, spearhead or mentor tasks, pitch new ideas, curate roadmaps, and provide feedback to other contributors. Longtime maintainers with a deep understanding of particular areas of {$this->trac_name()} are always seeking to mentor others to impart their knowledge.\n\n";
     427        echo "<strong>Want to help? Start following this component!</strong> <a href='/{$this->trac}/notifications/'>Adjust your notifications here</a>. Feel free to dig into any ticket." . "\n\n";
    408428
    409429        $followers = $this->api->get_component_followers( $post->post_title );
     
    479499
    480500        if ( is_singular() ) {
    481             echo '<div><a class="create-new-ticket button button-large button-primary" href="https://login.wordpress.org/?redirect_to=' . urlencode( 'https://core.trac.wordpress.org/newticket?component=' . urlencode( $component ) ) . '" rel="nofollow">Create a new ticket</a></div>';
     501            echo '<div><a class="create-new-ticket button button-large button-primary" href="https://login.wordpress.org/?redirect_to=' . urlencode( $this->trac_url() . '/newticket?component=' . urlencode( $component ) ) . '" rel="nofollow">Create a new ticket</a></div>';
    482502        }
    483503
     
    596616            $args['status'] = '!closed';
    597617        }
    598         return add_query_arg( $args, 'https://core.trac.wordpress.org/query' );
     618        return add_query_arg( $args, $this->trac_url() . '/query' );
    599619    }
    600620
     
    603623        foreach ( $tickets as $ticket ) {
    604624            $ticket = (object) $ticket;
    605             echo '<li><a href="https://core.trac.wordpress.org/ticket/' . $ticket->id . '">#' . $ticket->id . '</a> &nbsp;' . esc_html( $ticket->summary );
     625            echo '<li><a href="' . $this->trac_url() . '/ticket/' . $ticket->id . '">#' . $ticket->id . '</a> &nbsp;' . esc_html( $ticket->summary );
    606626            if ( ! empty( $ticket->focuses ) ) {
    607627                echo ' <span class="focus">' . implode( '</span> <span class="focus">', explode( ', ', esc_html( $ticket->focuses ) ) ) . '</span>';
     
    625645        $both = in_array( 'focus', $topics ) && in_array( 'component', $topics );
    626646
    627         echo '<select class="tickets-by-topic" data-location="https://core.trac.wordpress.org/">';
     647        echo '<select class="tickets-by-topic" data-location="' . $this->trac_url() . '/">';
    628648        if ( $both ) {
    629649            $default = 'Select a focus or component';
     
    691711            $open_tickets = array_sum( $this->breakdown_component_type[ $component ] );
    692712        }
    693         echo '<td class="right"><a href="https://core.trac.wordpress.org/component/' . esc_attr( rawurlencode( $component ) ) . '">' . $open_tickets . '</a></td>';
     713        echo '<td class="right"><a href="' . $this->trac_url() . '/component/' . esc_attr( rawurlencode( $component ) ) . '">' . $open_tickets . '</a></td>';
    694714        if ( $history['change'] ) {
    695715            $count = sprintf( "%+d", $history['change'] );
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php

    r11374 r11668  
    3030        $this->api  = new Trac_Notifications_HTTP_Client( $this->trac_url() . '/wpapi', TRAC_NOTIFICATIONS_API_KEY );
    3131
    32         if ( 'core' === $trac ) {
     32        if ( 'core' === $trac || 'meta' === $trac ) {
    3333            require __DIR__ . '/trac-components.php';
    3434            $this->components = new Make_Core_Trac_Components( $this->api );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/archive-component.php

    r4819 r11668  
    44 */
    55
     6$trac_name = 'Core';
     7if ( isset( $wporg_trac_notifications ) ) {
     8    $trac_name = $wporg_trac_notifications->trac_name();
     9}
    610?>
    711<?php get_header(); ?>
     
    913    <div id="primary" class="content-area">
    1014        <div role="main">
    11         <h1>WordPress Core Components</h1>
     15        <h1><?php printf( 'WordPress %s Components', $trac_name ); ?></h1>
    1216
    1317<?php
Note: See TracChangeset for help on using the changeset viewer.