- Timestamp:
- 05/05/2016 12:59:30 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/slack/trac/comment-handler.php
r3086 r3087 31 31 $lines = array_map( 'rtrim', $this->lines ); 32 32 $base64 = false; 33 $subject = ''; 33 34 34 35 // Trim off headers. … … 47 48 } elseif ( 0 === strpos( $line, 'Content-Transfer-Encoding: base64' ) ) { 48 49 $base64 = true; 50 } elseif ( 0 === strpos( $line, 'Subject:' ) ) { 51 $subject = str_replace( 'Subject: ', '', $line ); 52 53 $subject_lines = $lines; 54 while ( $subject_lines && ! preg_match( '/(^[\x21-\x7E][^:]+):/', current( $subject_lines ) ) ) { 55 $subject .= array_shift( $subject_lines ); 56 } 57 unset( $subject_lines ); 49 58 } 50 59 } … … 106 115 107 116 $changes = $comment = array(); 117 118 // Check if the summary of a ticket was changed. 119 if ( preg_match( '/ \(was: (.*)\)$/', $subject, $matches ) ) { 120 $changes[] = '_*summary:*_ ' . $matches[1] . ' => ' . $title; 121 } 122 108 123 if ( $has_changes ) { 109 124 while ( $lines && '' !== current( $lines ) ) { … … 157 172 $comment = $this->format_comment_for_slack(); 158 173 $main_attachment = $this->changes ? implode( "\n", $this->changes ) : $comment; 159 $pretext = sprintf( '*%s updated <%s|#%s %s>*', $this->author, $this->comment_url, $this->ticket_id, htmlspecialchars( $this->title, ENT_NOQUOTES ) ); 174 $author = $this->author ? $this->author : 'Someone'; 175 $pretext = sprintf( '*%s updated <%s|#%s %s>*', $author, $this->comment_url, $this->ticket_id, htmlspecialchars( $this->title, ENT_NOQUOTES ) ); 160 176 $fallback = trim( $pretext, '*' ) . "\n" . $main_attachment; 161 177
Note: See TracChangeset
for help on using the changeset viewer.