Making WordPress.org


Ignore:
Timestamp:
08/02/2015 01:26:10 AM (9 years ago)
Author:
nacin
Message:

Some infrastructure changes for the security team.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/mentions-handler.php

    r1187 r1801  
    2828    $search_text = preg_replace( "/^>.*\n\n/sm", '', $search_text );
    2929    $user_login  = $payload->author;
     30} elseif ( $payload->trac === 'security' ) {
     31    // Security Trac only handles comments.
     32    // Ticket data is found via a HTTP request, comments are from parsing the email.
     33    exit;
    3034} else {
    3135    $search_text = $payload->summary . ' ' . $payload->description;
     
    5458}
    5559
     60function wporg_mentions_limit_to_security_team( $usernames, $data ) {
     61    require_once dirname( __DIR__ ) . '/slack/security-team.php';
     62    $team = \Dotorg\Slack\Security_Team\get_security_team();
     63
     64    if ( ! empty( $data['object']->cc ) ) {
     65        // Add single ticket access users.
     66        $ccs = explode( ", ", $data['object']->cc );
     67        $team = array_merge( $team, $ccs );
     68    }
     69
     70    return $team;
     71}
     72
    5673if ( ! wporg_user_has_visited_trac( $user_login ) ) {
    5774    $wpdb->insert( 'trac_users', compact( 'user_login' ) );
     75}
     76
     77if ( $payload->trac === 'security' ) {
     78    add_filter( 'wporg_notifications_notifiable_usernames', 'wporg_mentions_limit_to_security_team', 10, 2 );
    5879}
    5980
Note: See TracChangeset for help on using the changeset viewer.