Making WordPress.org

Changeset 13519


Ignore:
Timestamp:
04/15/2024 03:55:00 AM (2 years ago)
Author:
dd32
Message:

Trac: Properly handle multiple @mention's within a ticket title when multiple links to the ticket/changeset are listed in a single comment.

This was previously only escaping/skipping the first @mention, which in this case was in the changeset text, the second instance was being skipped.

See https://meta.trac.wordpress.org/ticket/7584#comment:2

Location:
sites/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/trac.wordpress.org/templates/site.html

    r13213 r13519  
    55
    66<?python
    7         scripts_version = '217'
     7        scripts_version = '218'
    88        project_slug = req.environ['HTTP_HOST'].split(':')[0].split('.')[0]
    99        wporg_endpoint = 'https://make.wordpress.org/' + project_slug + '/'
  • sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js

    r13213 r13519  
    198198                        // See https://github.com/regexps/mentions-regex/blob/master/index.js#L21
    199199                        var mentionsRegEx = /(^|[^a-zA-Z0-9_@!@#$%&*])(?:(?:@|@)(?!\/))([a-zA-Z0-9_\-.]{1,20})(?:\b(?!@|@)|$)/g,
    200                                 mentionsInAttrRegEx = new RegExp( '="[^"]*?' + mentionsRegEx.source + '[\\s\\S]*?"' );
     200                                mentionsInAttrRegEx = new RegExp( '="[^"]*?' + mentionsRegEx.source + '[\\s\\S]*?"', 'g' );
    201201
    202202                        $( selector || 'div.change .comment, #ticket .description' ).each( function() {
     
    225225                                        // Restore mentions in HTML attributes.
    226226                                        if ( placeholders.length ) {
    227                                                 $comment = $comment.replace( '__PLACEHOLDER__', function() {
     227                                                $comment = $comment.replace( /__PLACEHOLDER__/g, function() {
    228228                                                        return placeholders.shift();
    229229                                                } );
Note: See TracChangeset for help on using the changeset viewer.