Changeset 1738 for sites/trunk/common/includes/slack/announce/lib.php
- Timestamp:
- 07/14/2015 03:49:50 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/slack/announce/lib.php
r1191 r1738 40 40 $channels = get_whitelisted_channels_for_user( $user ) ; 41 41 if ( $channel === 'privategroup' ) { 42 echo "Any private group members can use /announce in this group.";42 echo "Any private group members can use /announce and /here in this group."; 43 43 return; 44 44 } elseif ( empty( $channels ) ) { 45 echo "You are not allowed to use /announce .";45 echo "You are not allowed to use /announce or /here."; 46 46 } elseif ( in_array( $channel, $channels ) ) { 47 47 $channels = array_filter( $channels, function( $c ) use ( $channel ) { return $c !== $channel; } ); 48 48 if ( $channels ) { 49 printf( "You are allowed to use /announce in #%s (also %s).", $channel, '#' . implode( ' #', $channels ) );49 printf( "You are allowed to use /announce and /here in #%s (also %s).", $channel, '#' . implode( ' #', $channels ) ); 50 50 } else { 51 echo "You are allowed to use /announce in #$channel.";51 echo "You are allowed to use /announce and /here in #$channel."; 52 52 } 53 53 } else { 54 printf( "You are not allowed to use /announce in #%s, but you are in #%s.", $channel, implode( ' #', $channels ) );54 printf( "You are not allowed to use /announce or /here in #%s, but you are in #%s.", $channel, implode( ' #', $channels ) ); 55 55 } 56 56 … … 73 73 $send = new Send( \Dotorg\Slack\Send\WEBHOOK ); 74 74 $send->set_username( $user ); 75 $send->set_text( sprintf( "<!channel> %s", $data['text'] ) ); 75 76 $command = 'channel'; 77 if ( $data['command'] === '/here' ) { 78 $command = 'here'; 79 } elseif ( $channel === 'privategroup' ) { 80 // @channel and @group are interchangeable, but still. 81 $command = 'group'; 82 } 83 84 $send->set_text( sprintf( "<!%s> %s", $command, $data['text'] ) ); 76 85 77 86 $get_avatar = __NAMESPACE__ . '\\' . 'get_avatar';
Note: See TracChangeset
for help on using the changeset viewer.