Making WordPress.org

Changeset 11612


Ignore:
Timestamp:
02/25/2022 05:46:54 AM (3 years ago)
Author:
dd32
Message:

Trac: When suggesting components, do not suggest 'WordPress.org site' on Meta.

See #6078.

Location:
sites/trunk
Files:
2 edited

Legend:

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

    r11611 r11612  
    55
    66<?python
    7     scripts_version = '166'
     7    scripts_version = '167'
    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

    r11570 r11612  
    19201920        suggestNotGeneral: ( function() {
    19211921            var enabled = true,
    1922                 skipWords = [ 'and', 'any', 'all', 'the', 'for', 'get', 'plugins', 'general' ],
     1922                skipWords = [ 'and', 'any', 'all', 'the', 'for', 'get', 'plugins', 'general', 'wordpress' ],
     1923                generalCategories = [ 'General' ],
    19231924                componentWords = {},
    19241925                noticeDiv;
     
    19271928                // Only on new ticket creations.
    19281929                if ( ! wpTrac.isNewTicket() ) {
    1929                     return;
    1930                 }
    1931 
    1932                 // Only if we have a 'General' option.
    1933                 if ( ! $( '#field-component option[value="General"]' ).length ) {
    19341930                    return;
    19351931                }
     
    19431939                }
    19441940
     1941                // On Meta, WordPress.org site is a "generic" category that shouldn't be used if possible.
     1942                if ( $( 'body.meta' ).length ) {
     1943                    generalCategories.push( 'WordPress.org Site' );
     1944                    skipWords.push( 'wordpress.org' );
     1945                }
     1946
     1947                // Only if we have a 'General' option.
     1948                const components = jQuery( '#field-component option' ).get().map( opt => opt.value ),
     1949                    hasDefaultCat = generalCategories.filter( value => components.includes( value ) );
     1950
     1951                if ( ! hasDefaultCat ) {
     1952                    return;
     1953                }
     1954
    19451955                generateComponentWords();
    19461956
     
    19491959                // Disable once the user hits the component option.
    19501960                $( '#field-component' ).on( 'change', function() {
    1951                     // If they selected 'General', keep nagging.
    1952                     enabled = $(this).find( 'option[value="General"]').prop('selected');
     1961                    // If they selected a general category keep nagging.
     1962                    enabled = ( -1 !== generalCategories.indexOf( $(this).val() ) );
    19531963
    19541964                    if ( ! enabled && noticeDiv ) {
Note: See TracChangeset for help on using the changeset viewer.