Making WordPress.org

Changeset 10423


Ignore:
Timestamp:
11/03/2020 04:23:13 AM (6 years ago)
Author:
dd32
Message:

Slack: Announcements: Switch /announce and /here to use an at-here reserving at-channel for a new /at-channel command.

Due to the number of users in this slack instance now, an at-channel is not usually the intended default and causes notifications for a lot of users it's not necessarily relevant to.

/at-channel is still limited to those who have been specifically granted access, which is the same as those who could previously use /announce and /here..

This also includes some line breaks and rewording of the descriptive texts.

See ​https://wordpress.slack.com/archives/C02RQBWTW/p1604090126182300.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/slack/announce/lib.php

    r10405 r10423  
    3838
    3939function show_authorization( $user, $channel ) {
    40         $channels = get_whitelisted_channels_for_user( $user ) ;
     40
     41        echo "Valid commands are /at-channel for an @channel, and /announce or /here to perform an @here.\n";
     42
     43        $channels = get_whitelisted_channels_for_user( $user );
    4144        if ( $channel === 'privategroup' ) {
    42                 echo "Any private group members can use /announce and /here in this group.";
     45                echo "Any private group members can use these commands in this group.";
    4346                return;
    4447        } elseif ( empty( $channels ) ) {
    45                 echo "You are not allowed to use /announce or /here.";
     48                echo "You are not allowed to use these commands.";
    4649        } elseif ( in_array( $channel, $channels ) ) {
    4750                $channels = array_filter( $channels, function( $c ) use ( $channel ) { return $c !== $channel; } );
    4851                if ( $channels ) {
    49                         printf( "You are allowed to use /announce and /here in #%s (also %s).", $channel, '#' . implode( ' #', $channels ) );
     52                        printf( "You are allowed to use these commands in #%s (also %s).", $channel, '#' . implode( ' #', $channels ) );
    5053                } else {
    51                         echo "You are allowed to use /announce and /here in #$channel.";
     54                        echo "You are allowed to use these commands in in #$channel.";
    5255                }
    5356        } else {
    54                 printf( "You are not allowed to use /announce or /here in #%s, but you are in #%s.", $channel, implode( ' #', $channels ) );
     57                printf( "You are not allowed to use these commands in #%s, but you are in #%s.", $channel, implode( ' #', $channels ) );
    5558        }
    5659
    57         printf( " If you are a team lead and need to be whitelisted, contact an admin in <#%s|%s> for assistance. Your linked WordPress.org account is '%s'.", SLACKHELP_CHANNEL_ID, SLACKHELP_CHANNEL_NAME, $user );
     60        echo "\n";
     61
     62        printf( "If you are a team lead and need to be granted access, contact an admin in <#%s|%s> for assistance.\n", SLACKHELP_CHANNEL_ID, SLACKHELP_CHANNEL_NAME );
     63        printf( "Your linked WordPress.org account that needs to be granted access is '%s'.", $user );
    5864}
    5965
    … …  
    94100        }
    95101
    96         $command = 'channel';
    97         if ( $data['command'] === '/here' ) {
    98                 $command = 'here';
     102        if ( str_word_count( $data['text'] ) <= 2 ) {
     103                printf( "When making announcements, please use a descriptive message for notifications. %s is too short.", $data['text'] );
     104                return;
     105        }
     106
     107        // Default to an @here, unless explicitely an @channel OR it's a private group.
     108        $command = 'here';
     109        if ( $data['command'] === '/at-channel' ) {
     110                $command = 'channel';
    99111        } elseif ( $channel === 'privategroup' ) {
    100                 // @channel and @group are interchangeable, but still.
     112                // @channel and @group are interchangeable.
    101113                $command = 'group';
    102114        }
Note: See TracChangeset for help on using the changeset viewer.