Changeset 9121
- Timestamp:
- 08/29/2019 06:25:06 PM (5 years ago)
- Location:
- sites/trunk/common/includes/slack/announce
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/slack/announce/config.php
r9120 r9121 373 373 ); 374 374 } 375 376 // This is not all deputies; it's only the ones who want to receive `/deputies` pings377 function get_pingable_wordcamp_deputies() {378 return array(379 '00Sleepy', '_DorsVenabili', 'adityakane', 'andreamiddleton', 'bph', 'brandondove', 'camikaos',380 'chanthaboune', 'courtneypk', 'drebbits', 'francina', 'gounder', 'heysherie', 'hlashbrooke',381 'karenalma', 'kcristiano', 'kdrewien', 'Kenshino', 'mayukojpn', 'mikelking', 'miss_jwo',382 'nukaga', 'remediosgraphic', 'Savione', 'vc27', 'yaycheryl',383 384 'coreymckrill', 'iandunn', // todo remove after testing385 );386 } -
sites/trunk/common/includes/slack/announce/lib.php
r8068 r9121 84 84 } 85 85 86 if ( $data['command'] === '/deputies' ) { 87 $pingable_deputies = get_pingable_wordcamp_deputies(); 86 if ( ! is_user_whitelisted( $user, $channel ) ) { 87 show_authorization( $user, $channel ); 88 return; 89 } 88 90 89 if ( ! in_array( $user, $pingable_deputies, true ) ) { 90 return; 91 } 91 $command = 'channel'; 92 if ( $data['command'] === '/here' ) { 93 $command = 'here'; 94 } elseif ( $channel === 'privategroup' ) { 95 // @channel and @group are interchangeable, but still. 96 $command = 'group'; 97 } 92 98 93 // TODO: Note that pinging users by `@username` is deprecated, and we have WordPress.org usernames in the above list. 94 // This should be upadted to ping users by the `<@U.....>` format. 95 96 $text = sprintf( "*/deputies:* %s\n_(CC: %s)_", $data['text'], '@' . implode( ', @', $pingable_deputies ) ); 97 } else { 98 if ( ! is_user_whitelisted( $user, $channel ) ) { 99 show_authorization( $user, $channel ); 100 return; 101 } 102 103 $command = 'channel'; 104 if ( $data['command'] === '/here' ) { 105 $command = 'here'; 106 } elseif ( $channel === 'privategroup' ) { 107 // @channel and @group are interchangeable, but still. 108 $command = 'group'; 109 } 110 111 $text = sprintf( "<!%s> %s", $command, $data['text'] ); 112 } 99 $text = sprintf( "<!%s> %s", $command, $data['text'] ); 113 100 114 101 $send = new Send( \Dotorg\Slack\Send\WEBHOOK );
Note: See TracChangeset
for help on using the changeset viewer.