Making WordPress.org


Ignore:
Timestamp:
07/13/2023 03:45:24 AM (3 years ago)
Author:
dd32
Message:

Slack: Announce: When determining parent channels, accept that some parents may have parents.

Followup to [12722]. Reverts [12737].

File:
1 edited

Legend:

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

    r12722 r12738  
    140140            $root = 'core';
    141141            break;
    142         case 'mentorship':  // Such as #mentorship-cohort-july-2023
     142        case 'mentorship': // Such as #mentorship-cohort-july-2023
    143143            $root = 'contributor-mentorship';
    144144            break;
     
    173173    }
    174174
    175     return $parent_channels ?: false;
     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
     181    return array_unique( $parent_channels ) ?: false;
    176182}
    177183
Note: See TracChangeset for help on using the changeset viewer.