Making WordPress.org


Ignore:
Timestamp:
07/26/2015 06:55:54 PM (9 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.