Making WordPress.org


Ignore:
Timestamp:
01/29/2019 12:21:55 PM (8 years ago)
Author:
ocean90
Message:

Slack: Include timestamp in ticket attachments.

File:
1 edited

Legend:

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

    r3097 r8160  
    4040
    4141                $attachment['fields'] = self::get_ticket_fields( $this->data );
     42                $attachment['ts']     = strtotime( $this->data->created );
     43
     44                $attachment['footer']      = sprintf( '<%s|%s>', $this->trac->get_url(), $this->trac->get_name() );
     45                $attachment['footer_icon'] = sprintf( '%s/chrome/common/trac.ico', $this->trac->get_url() );
     46
    4247                return $attachment;
    4348        }
    … …  
    5358                }
    5459
    55                 $url = $this->get_url() . '?format=csv';
     60                $url = sprintf(
     61                        '%s/query?id=%s&col=id&col=summary&col=owner&col=type&col=cc&col=status&col=priority&col=milestone&col=component&col=version&col=severity&col=resolution&col=time&col=focuses&col=reporter&col=keywords&col=description&format=csv',
     62                        $this->trac->get_url(),
     63                        $this->id
     64                );
    5665                $contents = @file_get_contents( $url );
    5766                if ( $contents === false ) {
    … …  
    6473                $contents = explode( "\n", $contents, 2 );
    6574                $ticket_info = array_combine(
    66                         str_getcsv( $contents[0], ',', '"', '"' ),
     75                        str_getcsv( strtolower( $contents[0] ), ',', '"', '"' ),
    6776                        str_getcsv( $contents[1], ',', '"', '"' )
    6877                );
Note: See TracChangeset for help on using the changeset viewer.