Changeset 12613
- Timestamp:
- 06/02/2023 02:56:21 AM (3 years ago)
- Location:
- sites/trunk/api.wordpress.org/public_html/dotorg/helpscout
- Files:
-
- 2 edited
-
common.php (modified) (2 diffs)
-
webhook.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/common.php
r12612 r12613 468 468 * Keep a cached copy of the received emails in the database for querying. 469 469 * 470 * @param string $event Event name. 470 471 * @param object $request Helpscout request object / Conversation object. 471 472 */ 472 function log_email( $ request ) {473 function log_email( $event, $request ) { 473 474 global $wpdb; 474 475 475 if ( empty( $request->id ) || ! isset( $request->status ) ) { 476 trigger_error( 'Missing required properties on request object: ' . $_SERVER['HTTP_X_HELPSCOUT_EVENT'], E_USER_NOTICE ); 476 if ( str_starts_with( $event, 'convo.' ) ) { 477 return; 478 } 479 480 if ( empty( $request->id ) ) { 477 481 return; 478 482 } … … 481 485 $meta = $row ? $wpdb->get_results( $wpdb->prepare( 'SELECT meta_key, meta_value FROM %i WHERE helpscout_id = %d', "{$wpdb->base_prefix}helpscout_meta", $request->id ), ARRAY_A ) : []; 482 486 483 // We don't need to know about spam.484 if ( ' spam' === $request->status ) {487 // We don't need to know about deleted items or spam. 488 if ( 'convo.deleted' === $event || 'spam' === $request->status ) { 485 489 if ( $row ) { 486 490 $wpdb->delete( 'wporg_helpscout', [ 'id' => $request->id ] ); -
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/webhook.php
r12609 r12613 21 21 22 22 // Record the email in the database. 23 if ( str_starts_with( $event, 'convo.' ) ) { 24 log_email( $request ); 25 } 23 log_email( $event, $request ); 26 24 27 25 /**
Note: See TracChangeset
for help on using the changeset viewer.