sobek / pagure

Forked from pagure 6 years ago
Clone

53d919f Don't treat @ in the middle of words as a mention

Authored and Committed by adamwill 6 years ago
    Don't treat @ in the middle of words as a mention
    
    If there's a user called 'example', then *any* occurence of the
    string `@example` followed by a non-word character is treated
    as a mention. This is not how we handle this for anything else
    (e.g. issue or PR links) and has some obvious weird effects...
    like the string `someone@example.com` is treated as a mention
    of the user @example. So, let's not do that any more (by using
    the same negative lookbehind we use for other things).
    
    Also, drop the leading space from the `text` definition used in
    the pattern's `handleMatch()`. The regex doesn't capture any
    character before the @ and has not done for a long time, if it
    ever did, so this is just wrong. If you look at the raw page
    source of any Pagure page with an @mention in it, you can see
    that there's a bogus extra space before the @ due to this,
    though it seems that browsers (at least Firefox) strip it when
    rendering the HTML.
    
    Also add an explanation of what these negative lookbehinds we
    keep using are for, and how they work, since here above the
    first regex is a logical place, and @pingou asked for one...
    
    Signed-off-by: Adam Williamson <awilliam@redhat.com>
    
        
file modified
+10 -3
file modified
+9 -0