Changeset 11020
- Timestamp:
- 06/08/2021 06:06:51 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/slack/trac/bot.php
r10160 r11020 13 13 '#meta' => 'meta', 14 14 '#outreach' => false, 15 ); 16 17 // Channels that are primarily GitHub issues, where digit-only tickets should not be expanded. 18 static protected $github_channels = array( 19 '#core-editor', 15 20 ); 16 21 … … 44 49 45 50 function parse_tickets( $text ) { 46 $digits = Trac::get_digit_capture();51 $digits = Trac::get_digit_capture(); 47 52 $ticket_tracs = '?<trac>' . Trac::get_regex(); 48 preg_match_all( "/(?:\s|^|\()#(?<id>$digits)(?:\-($ticket_tracs))?\b/", $text, $tickets, PREG_SET_ORDER ); 53 $tickets = array(); 54 55 // If the channel is not GitHub centric, match #1234 as a Trac ticket 56 if ( ! in_array( $this->get_channel(), $this->github_channels, true ) ) { 57 preg_match_all( "/(?:\s|^|\()#(?<id>$digits)(?:\-($ticket_tracs))?\b/", $text, $tickets, PREG_SET_ORDER ); 58 } 59 60 // Always match trac-prefixed Tickets 49 61 preg_match_all( "/(?:\s|^|\()#($ticket_tracs)(?<id>$digits)\b/", $text, $tickets_alt, PREG_SET_ORDER ); 62 63 // Always match full URI's 50 64 preg_match_all( "~https?://($ticket_tracs).trac.wordpress.org/ticket/(?<id>$digits)~", $text, $tickets_url, PREG_SET_ORDER ); 65 51 66 foreach ( $tickets_url as &$ticket ) { 52 67 $ticket['url'] = true;
Note: See TracChangeset
for help on using the changeset viewer.