Making WordPress.org


Ignore:
Timestamp:
05/23/2024 01:06:52 AM (2 years ago)
Author:
dd32
Message:

Slack: Announce: Fix the parent channels for #accessibility.

Previously sub-channels of accessibility couldn't inherit permissions from #accessibility due to it's only parent being #core.
This resolves that to mark both #core and #accessibility to be parents of #accessibility-$NAME.

See ​https://wordpress.slack.com/archives/C02QB8GMM/p1716398834795689?thread_ts=1716235708.408869&cid=C02QB8GMM.

File:
1 edited

Legend:

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

    r12761 r13748  
    4545
    4646        foreach ( (array) $parent_channels as $parent ) {
     47                // Avoid any circular references.
     48                if ( ! $parent || $parent === $channel ) {
     49                        continue;
     50                }
     51
    4752                $users = array_merge( $users, $whitelist[ $parent ] ?? [] );
    4853        }
    … …  
    133138        // Some channels parents are not a 1:1 match.
    134139        switch ( $root ) {
    135                 case 'accessibility':
    136140                case 'design':
    137141                case 'feature':
    138142                case 'performance':
    139143                case 'tide':
     144                case 'core':
    140145                        $root = 'core';
    141146                        break;
    … …  
    153158        }
    154159
    155         // No parent channel!
    156         if ( $root === $channel ) {
    157                 return false;
    158         }
    159 
    160160        $parent_channels = [];
    161161
    162162        // For when a channel has multiple parents.
    163         switch ( $channel ) {
    164                 case 'meta-learn':
    165                         $parent_channels[] = 'training';
    166                         // Intentional Fallthrough.
    167                 default:
    168                         // Is it an actual channel? Assume that there'll always be at least one whitelisted user for the parent channel.
    169                         if ( get_whitelist_for_channel( $root ) ) {
    170                                 $parent_channels[] = $root;
    171                         }
     163
     164        // Accessibility is a sub-team of Core, but is a parent channel itself.
     165        if ( 'accessibility' === $root ) {
     166                $parent_channels[] = 'core';
     167        }
     168
     169        // Learn is a sub-team of Training, plus of #meta.
     170        if ( 'meta-learn' === $channel ) {
     171                $parent_channels[] = 'training';
     172        }
     173
     174        // Is it an actual channel? Assume that there'll always be at least one whitelisted user for the parent channel.
     175        if (
     176                $root !== $channel &&
     177                get_whitelist_for_channel( $root )
     178        ) {
     179                $parent_channels[] = $root;
    172180        }
    173181
Note: See TracChangeset for help on using the changeset viewer.