Making WordPress.org


Ignore:
Timestamp:
01/23/2015 11:36:13 PM (9 years ago)
Author:
nacin
Message:

Trac mentions: Strip quoted reply text from the text being searched. This way, a mention isn't replayed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/mentions-handler.php

    r1183 r1184  
    2323$type = $payload->type === 'comment' ? 'comment' : 'ticket';
    2424
    25 $search_text = 'comment' === $type ? $payload->comment : $payload->summary . ' ' . $payload->description;
    26 $user_login  = 'comment' === $type ? $payload->author  : $payload->reporter;
    27 $user        = get_user_by( 'login', $user_login );
     25if ( 'comment' === $type ) {
     26    $search_text = $payload->comment;
     27    // Remove reply (quoted) text.
     28    $search_text = preg_replace( "/^>.*\n\n/sm", '', $search_text );
     29    $user_login  = $payload->author;
     30} else {
     31    $search_text = $payload->summary . ' ' . $payload->description;
     32    $user_login  = $payload->reporter;
     33}
     34
     35$user = get_user_by( 'login', $user_login );
    2836
    2937function wporg_user_has_visited_trac( $user_login ) {
Note: See TracChangeset for help on using the changeset viewer.