- Timestamp:
- 05/22/2020 05:52:27 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 );
Note: See TracChangeset
for help on using the changeset viewer.