Changeset 12116
- Timestamp:
- 10/12/2022 07:39:00 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php
r11544 r12116 134 134 } 135 135 136 $authorship = "[{$pr_data->user->url} {$pr_data->user->name}]"; 137 if ( $user_id ) { 138 $user = get_user_by( 'id', $user_id ); 139 $authorship = "[https://profiles.wordpress.org/{$user->user_nicename}/ @{$user->user_login}]"; 140 } 141 136 142 $trac->update( 137 143 $pr_data->trac_ticket[1], 138 144 "''This ticket was mentioned in [{$pr_data->html_url} PR #{$pr_number}] " . 139 145 "on [https://github.com/{$pr_repo}/ {$pr_repo}] " . 140 "by [{$pr_data->user->url} {$pr_data->user->name}].''" .146 "by {$authorship}.''" . 141 147 ( $pr_description ? "\n{$pr_description}" : '' ), 142 148 $attributes, // Attributes changed … … 201 207 } 202 208 203 $comment_template = "{{{#!comment\n%s\n}}}\n[%s %s] commented on [%s %s]:\n\n%s"; 204 $comment_author = find_wporg_user_by_github( $payload->comment->user->login ); 209 $comment_template = "{{{#!comment\n%s\n}}}\n%s commented on [%s %s]:\n\n%s"; 210 $user_id = find_wporg_user_by_github( $payload->comment->user->login, 'ID' ); 211 $authorship = "[{$payload->comment->user->html_url} {$payload->comment->user->login}]"; 212 $comment_author = ''; 205 213 $comment_time = new \DateTime( $payload->comment->created_at ); 214 215 if ( $user_id ) { 216 $user = get_user_by( 'id', $user_id ); 217 $authorship = "[https://profiles.wordpress.org/{$user->user_nicename}/ @{$user->user_login}]"; 218 $comment_author = $user->user_login; 219 } 206 220 207 221 $comment_body = sprintf( 208 222 $comment_template, 209 223 $payload->comment->id, 210 $payload->comment->user->html_url, 211 $payload->comment->user->login, 224 $authorship, 212 225 $payload->comment->html_url, 213 226 'PR #' . $payload->issue->number,
Note: See TracChangeset
for help on using the changeset viewer.