Making WordPress.org

Changeset 14848


Ignore:
Timestamp:
04/28/2026 06:50:25 AM (4 months ago)
Author:
dd32
Message:

Slack: Subgroups: alphabetize list, allow #foo-planning root, fix dialog labels.

File:
1 edited

Legend:

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

    r14847 r14848  
    969969
    970970/*
    971  * Channels ending in -team are private workspaces for a (often public) base
    972  * channel — `#wcus-team` for `#wcus`. Subgroups should follow the base
    973  * channel's name (`wcus-foo`), not the team's (`wcus-team-foo`), so users in
    974  * the public base channel discover them naturally. Notifications still go to
    975  * the channel where /subgroup was invoked.
     971 * Channels ending in -team or -planning are private workspaces for a (often
     972 * public) base channel — `#wcus-team` or `#wcus-planning` for `#wcus`.
     973 * Subgroups should follow the base channel's name (`wcus-foo`), not the
     974 * workspace's (`wcus-team-foo`), so users in the public base channel discover
     975 * them naturally. Notifications still go to the channel where /subgroup was
     976 * invoked.
    976977 */
    977978function derive_prefix_name( $channel_name ) {
    978         if ( substr( $channel_name, -5 ) === '-team' ) {
    979                 return substr( $channel_name, 0, -5 );
     979        foreach ( [ '-team', '-planning' ] as $suffix ) {
     980                if ( str_ends_with( $channel_name, $suffix ) ) {
     981                        return substr( $channel_name, 0, -strlen( $suffix ) );
     982                }
    980983        }
    981984        return $channel_name;
     
    990993                }
    991994        }
     995        usort( $out, function ( $a, $b ) {
     996                return strcmp( $a['name'], $b['name'] );
     997        } );
    992998        return $out;
    993999}
     
    11391145                                                'confirm'   => [
    11401146                                                        'title'   => [ 'type' => 'plain_text', 'text' => 'Rotate channel?' ],
    1141                                                         'text'    => [ 'type' => 'mrkdwn', 'text' => "Archive <#{$g['id']}> with a year suffix and create a fresh `{$g['name']}` with only you as a member." ],
     1147                                                        'text'    => [ 'type' => 'mrkdwn', 'text' => "Archive `{$g['name']}` with a year suffix and create a fresh copy with only you as a member." ],
    11421148                                                        'confirm' => [ 'type' => 'plain_text', 'text' => 'Rotate' ],
    11431149                                                        'deny'    => [ 'type' => 'plain_text', 'text' => 'Cancel' ],
     
    11521158                                                'confirm'   => [
    11531159                                                        'title'   => [ 'type' => 'plain_text', 'text' => 'Archive channel?' ],
    1154                                                         'text'    => [ 'type' => 'mrkdwn', 'text' => "Archive <#{$g['id']}>?" ],
     1160                                                        'text'    => [ 'type' => 'mrkdwn', 'text' => "Archive `{$g['name']}`?" ],
    11551161                                                        'confirm' => [ 'type' => 'plain_text', 'text' => 'Archive' ],
    11561162                                                        'deny'    => [ 'type' => 'plain_text', 'text' => 'Cancel' ],
     
    12461252                                'text' => [
    12471253                                        'type' => 'mrkdwn',
    1248                                         'text' => sprintf( 'Renaming <#%s>.', $channel_id ),
     1254                                        'text' => sprintf( 'Renaming `%s`.', $current_name ),
    12491255                                ],
    12501256                        ],
Note: See TracChangeset for help on using the changeset viewer.