Making WordPress.org


Ignore:
Timestamp:
07/26/2023 07:13:49 AM (3 years ago)
Author:
dd32
Message:

Slack: Don't send /here broadcasts to parent channels for certain groups, as it causes confusion.

File:
1 edited

Legend:

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

    r12738 r12761  
    143143                        $root = 'contributor-mentorship';
    144144                        break;
    145                 case 'contributor': // Such as #contributor-mentorship
    146145                case 'community':
    147146                        $root = 'community-team';
     
    173172        }
    174173
    175         // Recurse, in case the parent channel has a parent channel.
    176         // ie. #mentorship-cohort-july-2023 => #contributor-mentorship => #community-team
    177         foreach ( $parent_channels as $parent_channel ) {
    178                 $parent_channels = array_merge( $parent_channels, get_parent_channels( $parent_channel ) ?: [] );
    179         }
    180 
    181174        return array_unique( $parent_channels ) ?: false;
    182175}
     
    291284        }
    292285
     286        // Don't send to these parent channels.
     287        $dont_send_to = [
     288                'contributor-mentorship',
     289        ];
     290
    293291        $text = $data['text'];
    294292        // Remove any @here or @channel
     
    299297
    300298        foreach ( $parent_channels as $parent_channel ) {
     299                if ( in_array( $parent_channel, $dont_send_to, true ) ) {
     300                        continue;
     301                }
     302
    301303                $send->set_text( 'In #' . $channel . ': ' . $text );
    302304                $send->send( '#' . $parent_channel );
Note: See TracChangeset for help on using the changeset viewer.