Making WordPress.org

Changeset 3055


Ignore:
Timestamp:
05/01/2016 10:27:41 PM (11 years ago)
Author:
ocean90
Message:

Slack: In Trac::get_ticket_channels() support $ticket_component_filters with strings.

File:
1 edited

Legend:

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

    r1803 r3055  
    9494                $ns = __NAMESPACE__ . '\\Tracs\\';
    9595
    96                 $class = $ns . $trac;   
     96                $class = $ns . $trac;
    9797                if ( class_exists( $class ) ) {
    9898                        return new $class;
    … …  
    103103                        return new $class;
    104104                }
    105                
     105
    106106                if ( preg_match( '~([a-z]+).trac.wordpress.org~', $trac, $match ) ) {
    107107                        $class = $ns . $match[1];
    … …  
    252252
    253253                if ( isset( $ticket->component ) && isset( $this->ticket_component_filters[ $ticket->component ] ) ) {
    254                         $channels = array_merge( $channels, (array) $this->ticket_component_filters[ $ticket->component ] );
     254                        if ( is_string( $this->ticket_component_filters[ $ticket->component ] ) ) {
     255                                $channels = array_merge( $channels, array( $this->ticket_component_filters[ $ticket->component ] => true ) );
     256                        } else {
     257                                $channels = array_merge( $channels, $this->ticket_component_filters[ $ticket->component ] );
     258                        }
    255259                }
    256260
    257261                if ( isset( $ticket->focuses ) ) {
    258262                        foreach ( explode( ', ', $ticket->focuses ) as $focus ) {
    259                                 if ( isset( $this->ticket_component_filters[ $focus ] ) ) {
    260                                         $channels = array_merge( $channels, (array) $this->ticket_component_filters[ $focus ] );
     263                                if ( ! isset( $this->ticket_component_filters[ $focus ] ) ) {
     264                                        continue;
     265                                }
     266                                if ( is_string( $this->ticket_component_filters[ $focus ] ) ) {
     267                                        $channels = array_merge( $channels, array( $this->ticket_component_filters[ $focus ] => true ) );
     268                                } else {
     269                                        $channels = array_merge( $channels, $this->ticket_component_filters[ $focus ] );
    261270                                }
    262271                        }
    … …  
    277286                if ( $channel === $this->primary_channel ) {
    278287                        return $this->primary_channel_ticket_format;
    279                 }               
     288                }
    280289                return 'description';
    281290        }
    … …  
    284293                $text = str_replace( "\r\n", "\n", $text );
    285294                $text = trim( str_replace(
    286                         array( "\n{{{\n", "\n}}}\n", '{{{', '}}}' ),   
     295                        array( "\n{{{\n", "\n}}}\n", '{{{', '}}}' ),
    287296                        array( "\n```\n", "\n```\n", '`',   '`' ),
    288297                        "\n$text\n"
Note: See TracChangeset for help on using the changeset viewer.