Changeset 9900
- Timestamp:
- 05/22/2020 05:52:27 AM (4 years ago)
- Location:
- sites/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php
r9898 r9900 59 59 } 60 60 61 $touches_tests = false; 62 $_files = api_request( 63 '/repos/' . $repo . '/pulls/' . intval( $pr ) . '/files?per_page=999', 64 null, 65 [ 'Accept: application/vnd.github.antiope-preview+json' ] 66 ); 67 foreach ( $_files as $f ) { 68 if ( preg_match( '!(^tests/|/tests/)!', $f->filename ) ) { 69 $touches_tests = true; 70 break; 71 } 72 } 73 61 74 return (object) [ 62 75 'repo' => $data->base->repo->full_name, … … 71 84 'check_runs' => $check_runs, 72 85 'reviews' => $reviews, 86 'touches_tests' => $touches_tests, 73 87 'body' => $data->body, 74 88 'user' => (object) [ -
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php
r9564 r9900 83 83 84 84 $pr_description = format_pr_desc_for_trac_comment( $pr_data ); 85 $attributes = []; 86 87 // Update ticket keywords if possible. 88 $ticket = $trac->get( $pr_data->trac_ticket[1] ); 89 if ( $ticket ) { 90 $keywords = preg_split( '![,\s]+!', $ticket['keywords'] ); 91 92 // Remove needs-patch 93 if ( false !== ( $key = array_search( 'needs-patch', $keywords ) ) ) { 94 unset( $keywords[ $key ] ); 95 } 96 if ( false !== ( $key = array_search( 'needs-refresh', $keywords ) ) ) { 97 unset( $keywords[ $key ] ); 98 } 99 100 // Add has-patch if not already there. 101 if ( false === array_search( 'has-patch', $keywords ) ) { 102 $keywords[] = 'has-patch'; 103 } 104 105 if ( $pr_data->touches_tests ) { 106 if ( false !== ( $key = array_search( 'needs-unit-tests', $keywords ) ) ) { 107 unset( $keywords[ $key ] ); 108 } 109 if ( false === array_search( 'has-unit-tests', $keywords ) ) { 110 $keywords[] = 'has-unit-tests'; 111 } 112 } 113 114 $attributes['keywords'] = implode( ' ', $keywords ); 115 } 85 116 86 117 $trac->update( … … 90 121 "by [{$pr_data->user->url} {$pr_data->user->name}].''" . 91 122 ( $pr_description ? "\n{$pr_description}" : '' ), 92 [], // Attributes changed123 $attributes, // Attributes changed 93 124 true // Notify 94 125 ); -
sites/trunk/trac.wordpress.org/templates/ticket_change.html
r9531 r9900 59 59 pr_byline = change.comment.partition('\n')[0]; 60 60 pr_comment = ''.join(change.comment.partition('\n')[1:]) or False; 61 prbot_class = 'prbot with-context' if pr_comment else 'prbot without-context';61 prbot_class = 'prbot with-context' if pr_comment or change.fields else 'prbot without-context'; 62 62 "> 63 63 <h3 class="change chat-bot ${prbot_class}"> … … 70 70 </span> 71 71 </h3> 72 <ul py:if="change.fields" class="changes"> 73 <li py:for="field_name, field in sorted(change.fields.iteritems(), key=lambda item: item[1].label.lower())" 74 class="trac-field-${field_name}"> 75 <strong class="trac-field-${field_name}">${field.label}</strong> 76 <py:choose> 77 <py:when test="'rendered' in field">${field.rendered}</py:when> 78 <py:when test="field.old and field.new"><i18n:msg params="old, new"> 79 changed from <em>${field.old}</em> to <em>${field.new}</em> 80 </i18n:msg></py:when> 81 <py:when test="not field.old and field.new"><i18n:msg params="value"> 82 set to <em>${field.new}</em> 83 </i18n:msg></py:when> 84 <py:otherwise><i18n:msg params="value"> 85 <em>${field.old}</em> deleted 86 </i18n:msg></py:otherwise> 87 </py:choose> 88 </li> 89 </ul> 72 90 <div py:if="pr_comment" class="comment searchable" xml:space="preserve"> 73 91 ${wiki_to_html(context, pr_comment, escape_newlines=preserve_newlines)}
Note: See TracChangeset
for help on using the changeset viewer.