Making WordPress.org

Changeset 1130


Ignore:
Timestamp:
01/12/2015 02:53:22 PM (12 years ago)
Author:
nacin
Message:

Slack: Update library to fix bugs found in testing. Mostly wrong variables.

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

Legend:

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

    r1121 r1130  
    55class Comment_Handler {
    66
    7         function __construct( Dotorg\Slack\Send $send, array $email_message ) {
     7        function __construct( \Dotorg\Slack\Send $send, array $email_message ) {
    88                $this->send  = $send;
    99                $this->lines = $email_message;
    … …  
    1919
    2020                $this->generate_payload();
    21                 $this->send->send( $trac->get_firehose_channel() );
     21                $this->send->send( $this->trac->get_firehose_channel() );
    2222        }
    2323
    … …  
    3434                                list( $trac_url, $ticket_id ) = explode( '/ticket/', $ticket_url );
    3535       
    36                                 $trac = Dotorg\Slack\Trac::get( $trac_url );
     36                                $trac = Trac::get( $trac_url );
    3737                                if ( ! $trac ) {
    3838                                        return false;
    … …  
    109109
    110110                // Everything left is the comment. Remove leading space.
    111                 $comment = array_map( 'ltrim', $lines );
     111                $comment = implode( "\n", array_map( 'ltrim', $lines ) );
    112112
    113113                $this->trac    = $trac;
    … …  
    141141                       
    142142                $comment         = $this->format_comment_for_slack();
    143                 $main_attachment = $this->changes ? $this->changes : $comment;
     143                $main_attachment = $this->changes ? implode( "\n", $this->changes ) : $comment;
     144                $pretext         = sprintf( '*%s updated <%s|#%s %s>*', $this->author, $this->comment_url, $this->ticket_id, $this->title );
    144145                $fallback        = trim( $pretext, '*' ) . "\n" . $main_attachment;
    145                 $pretext         = sprintf( '*%s updated <%s|#%s %s>*', $this->author, $this->comment_url, $this->ticket_id, $this->title );
    146146
    147147                $attachment = array(
  • sites/trunk/common/includes/slack/trac/ticket.php

    r1121 r1130  
    7373
    7474        static function get_ticket_fields( $ticket ) {
    75                 $new = false !== strpos( get_class( $this ), 'New_Ticket' );
     75                $new = false !== strpos( get_called_class(), 'New_Ticket' );
    7676       
    7777                $ticket_fields = array();
  • sites/trunk/common/includes/slack/trac/trac.php

    r1121 r1130  
    103103                }
    104104               
    105                 if ( preg_match( '~([a-z]+).trac.wordpress.org~', $url, $match ) ) {
     105                if ( preg_match( '~([a-z]+).trac.wordpress.org~', $trac, $match ) ) {
    106106                        $class = $ns . $match[1];
    107107                        if ( class_exists( $class ) ) {
Note: See TracChangeset for help on using the changeset viewer.