Making WordPress.org

Changeset 8176


Ignore:
Timestamp:
02/02/2019 09:51:16 AM (6 years ago)
Author:
ocean90
Message:

Slack: Don't include links in pretext fields, use title and title_link instead.

Makes the link clickable in mobile apps and also follows Slack's guidelines for building messages.

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

Legend:

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

    r1121 r8176  
    2323        }
    2424
    25         $attachment['pretext'] = preg_replace( '/: /', ": \n", $attachment['text'], 1 );
    26         $attachment['mrkdwn_in'][] = 'pretext';
    27         $attachment['text'] = Trac::format_for_slack( $this->description );
     25        $attachment['pretext'] = sprintf( 'New %s opened by %s', self::get_type( $this->type ), $this->reporter );
     26
     27        $attachment['text']  = Trac::format_for_slack( $this->description );
    2828        $attachment['color'] = $this->trac->get_color();
     29
    2930        return $attachment;
    3031    }
     
    5657
    5758        return $attachments;
    58     }   
     59    }
    5960}
  • sites/trunk/common/includes/slack/trac/ticket.php

    r8160 r8176  
    3838            return false;
    3939        }
     40
     41        unset( $attachment['text'] ); // Moved to title and title_link.
     42
     43        $attachment['title']      = sprintf( '#%s: %s', $this->id, htmlspecialchars( $this->summary, ENT_NOQUOTES ) );
     44        $attachment['title_link'] = $this->get_url();
    4045
    4146        $attachment['fields'] = self::get_ticket_fields( $this->data );
Note: See TracChangeset for help on using the changeset viewer.