Make WordPress Core

Changeset 42848 for branches/4.9


Ignore:
Timestamp:
03/18/2018 04:19:50 PM (7 years ago)
Author:
ocean90
Message:

Media: Grid view - correct placeholder positioning during uploads.

Preventing contextually created attachments from being added to the grid collection in Attachments.validator. Remove the previous filtering introduced in [41937] which caused the placement issue.

Merge of [42739-42740] to the 4.9 branch.

Props lancewillett, Junaidkbr, designsimply, joemcgill.
Fixes #42968.

Location:
branches/4.9
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/js/media-models.js

    r41752 r42848  
    643643     */
    644644    validator: function( attachment ) {
     645
     646        // Filter out contextually created attachments (e.g. headers, logos, etc.).
     647        if (
     648            ! _.isUndefined( attachment.attributes.context ) &&
     649            '' !== attachment.attributes.context
     650        ) {
     651            return false;
     652        }
     653
    645654        if ( ! this.validateDestroyed && attachment.destroyed ) {
    646655            return false;
  • branches/4.9/src/wp-includes/js/media-views.js

    r42627 r42848  
    954954        }
    955955
    956         this._filterContext();
    957         this.get('library').on( 'add', this._filterContext, this );
    958 
    959956        this.resetDisplays();
    960957    },
     
    11561153            setUserSetting( 'libraryContent', mode );
    11571154        }
    1158     },
    1159 
    1160     /**
    1161      * Filter out contextually created attachments (e.g. headers, logos, etc.)
    1162      *
    1163      * @since 4.9.0
    1164      */
    1165     _filterContext: function() {
    1166         var library = this.get('library');
    1167 
    1168         library.set( library.filter( function( item ) {
    1169             return item.get('context') === '';
    1170         } ) );
    11711155    }
     1156
    11721157});
    11731158
  • branches/4.9/src/wp-includes/js/media/controllers/library.js

    r41937 r42848  
    8686        }
    8787
    88         this._filterContext();
    89         this.get('library').on( 'add', this._filterContext, this );
    90 
    9188        this.resetDisplays();
    9289    },
     
    288285            setUserSetting( 'libraryContent', mode );
    289286        }
    290     },
    291 
    292     /**
    293      * Filter out contextually created attachments (e.g. headers, logos, etc.)
    294      *
    295      * @since 4.9.0
    296      */
    297     _filterContext: function() {
    298         var library = this.get('library');
    299 
    300         library.set( library.filter( function( item ) {
    301             return item.get('context') === '';
    302         } ) );
    303287    }
     288
    304289});
    305290
  • branches/4.9/src/wp-includes/js/media/models/attachments.js

    r41351 r42848  
    152152     */
    153153    validator: function( attachment ) {
     154
     155        // Filter out contextually created attachments (e.g. headers, logos, etc.).
     156        if (
     157            ! _.isUndefined( attachment.attributes.context ) &&
     158            '' !== attachment.attributes.context
     159        ) {
     160            return false;
     161        }
     162
    154163        if ( ! this.validateDestroyed && attachment.destroyed ) {
    155164            return false;
Note: See TracChangeset for help on using the changeset viewer.