Making WordPress.org

Changeset 1787


Ignore:
Timestamp:
07/26/2015 06:55:54 PM (11 years ago)
Author:
nacin
Message:

Migrate @committers to /committers.

This will allow committer names to be included in the message, thus triggering a push notification with the actual content.

Location:
sites/trunk/api.wordpress.org/public_html/dotorg/slack
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/slack/announce.php

    r1737 r1787  
    2727}
    2828
    29 if ( $_POST['token'] !== WEBHOOK_TOKEN && $_POST['token'] !== WEBHOOK_TOKEN_ALT ) {
    30         return;
     29$i = 0;
     30// WEBHOOK_TOKEN_1, WEBHOOK_TOKEN_2, etc.
     31while ( defined( __NAMESPACE__ . '\\WEBHOOK_TOKEN_' . ++$i ) ) {
     32        if ( constant( __NAMESPACE__ . '\\WEBHOOK_TOKEN_' . $i ) === $_POST['token'] ) {
     33                run( $_POST );
     34        }
    3135}
    3236
    33 run( $_POST );
     37}
    3438
    35 }
  • sites/trunk/api.wordpress.org/public_html/dotorg/slack/committers.php

    r1613 r1787  
    1111}
    1212
    13 // These should be Slack usernames.
    14 switch ( $_POST['channel_name'] ) {
    15         case 'bbpress' :
    16         case 'buddypress' :
    17         case 'glotpress' :
    18                 return;
    19         default:
    20                 $committers = array(
    21                         'westi', 'azaozz', 'nb', 'josephscott', 'dd32', 'nacin', 'koop', 'duck_',
    22                         'helen', 'sergey', 'ocean90', 'wonderboymusic', 'drew', 'mark', 'johnbillion',
    23                         'kovshenin', 'jorbin', 'boone', 'jeremyfelt', 'pento', 'obenland', 'iseulde',
    24                         'westonruter',
    25                 );
    26                 break;
    27 }
     13echo json_encode( array(
     14        'username'   => 'wordpressdotorg',
     15        'link_names' => 1,
     16        'text'       => sprintf( '@%s: Use the `/committers` command.', $_POST['user_name'] ),
     17) );
    2818
    29 if ( in_array( $_POST['user_name'], $committers, true ) ) {
    30         $notify = array_diff( $committers, array( $_POST['user_name'] ) );
    31         $notify = '(cc: @' . implode( ' @', $notify ) . ')';
    32         echo json_encode( array( 'text' => $notify, 'username' => $_POST['user_name'], 'link_names' => 1 ) );
    33 }
     19exit;
Note: See TracChangeset for help on using the changeset viewer.