Making WordPress.org

Changeset 9218


Ignore:
Timestamp:
10/21/2019 07:12:19 AM (7 years ago)
Author:
dd32
Message:

Slack: Attempt to pipe commits to channels when the commit message starts with the component.

See #4471.

Location:
sites/trunk/common/includes/slack/trac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/slack/trac/commit-handler.php

    r8183 r9218  
    2222        public function run() {
    2323                $this->generate_payload();
    24                 foreach ( $this->trac->get_commit_channels( $this->svnlook( 'changed' ) ) as $channel ) {
     24                foreach ( $this->trac->get_commit_channels( $this->svnlook( 'changed' ), $this->svnlook( 'log' ) ) as $channel ) {
    2525                        $this->send->send( $channel );
    2626                }
  • sites/trunk/common/includes/slack/trac/trac.php

    r7347 r9218  
    8080                                $this->ticket_component_filters[ $component ] = array( $channel => true );
    8181                        }
    82             if ( $this->bypass_primary_channel_for_ticket_filter_matches && empty( $this->ticket_component_filters[ $component ][ $this->primary_channel ] ) ) {
    83                 $this->ticket_component_filters[ $component ][ $this->primary_channel ] = false;
    84             }
     82                        if ( $this->bypass_primary_channel_for_ticket_filter_matches && empty( $this->ticket_component_filters[ $component ][ $this->primary_channel ] ) ) {
     83                                $this->ticket_component_filters[ $component ][ $this->primary_channel ] = false;
     84                        }
    8585                }
    8686        }
    … …  
    211211        }
    212212
    213         function get_commit_channels( $changed_files = null ) {
     213        function get_commit_channels( $changed_files = null, $log_text = null ) {
    214214                $channels = array();
    215215
    … …  
    233233                }
    234234
     235                foreach ( $this->ticket_component_filters as $component => $channels_to_add ) {
     236                        if ( 0 === stripos( $log_text, $component ) ) {
     237                                $channels = array_merge( $channels, (array) $channels_to_add );
     238                        }
     239                }
     240
    235241                if ( $this->firehose_channel ) {
    236242                        $channels[ $this->firehose_channel ] = true;
Note: See TracChangeset for help on using the changeset viewer.