Make WordPress Core

Changeset 31406


Ignore:
Timestamp:
02/10/2015 10:53:34 PM (10 years ago)
Author:
wonderboymusic
Message:

Use Math.round() instead of Math.floor() when determining page of attachments to query in wp.media.model.Query.sync.

This was causing an infinite loop of AJAX requests - so.... good catch!

Props Veritaserum.
Fixes #31116.

Location:
trunk/src/wp-includes/js/media
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media/models.js

    r31399 r31406  
    12311231            // Determine which page to query.
    12321232            if ( -1 !== args.posts_per_page ) {
    1233                 args.paged = Math.floor( this.length / args.posts_per_page ) + 1;
     1233                args.paged = Math.round( this.length / args.posts_per_page ) + 1;
    12341234            }
    12351235
  • trunk/src/wp-includes/js/media/models/query.js

    r31385 r31406  
    139139            // Determine which page to query.
    140140            if ( -1 !== args.posts_per_page ) {
    141                 args.paged = Math.floor( this.length / args.posts_per_page ) + 1;
     141                args.paged = Math.round( this.length / args.posts_per_page ) + 1;
    142142            }
    143143
Note: See TracChangeset for help on using the changeset viewer.