Skip to:
Content

BuddyPress.org

Changeset 12182


Ignore:
Timestamp:
07/06/2018 07:20:38 PM (7 years ago)
Author:
r-a-y
Message:

Legacy: Fix activity stream's "Load More" button.

In the bp-legacy template pack, the "Load More" button used to be tied to
the bp-activity-oldestpage cookie. In v3.0, we made steps to remove
this cookie, but this broke activity pagination when used via AJAX (see

This commit outright removes dependencies on the bp-activity-oldestpage
cookie and uses a local variable to track the current activity pagination
number.

Props boonebgorges.

See #7896 (trunk).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/js/buddypress.js

    r12082 r12182  
    1212
    1313jq(document).ready( function() {
     14    var activity_oldestpage = 1;
     15
    1416    /**** Page Load Actions *******************************************************/
    1517
     
    258260        }
    259261
    260         /* Reset the page */
    261         jq.cookie( 'bp-activity-oldestpage', 1, {
    262             path: '/',
    263             secure: ( 'https:' === window.location.protocol )
    264         } );
    265 
    266262        /* Activity Stream Tabs */
    267263        scope  = target.attr('id').substr( 9, target.attr('id').length );
     
    439435            jq('#buddypress li.load-more').addClass('loading');
    440436
    441             if ( ! jq.cookie('bp-activity-oldestpage') ) {
    442                 jq.cookie('bp-activity-oldestpage', 1, {
    443                     path: '/',
    444                     secure: ( 'https:' === window.location.protocol )
    445                 } );
    446             }
    447 
    448             oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1;
     437            oldest_page = activity_oldestpage + 1;
    449438            just_posted = [];
    450439
     
    470459            {
    471460                jq('#buddypress li.load-more').removeClass('loading');
    472                 jq.cookie( 'bp-activity-oldestpage', oldest_page, {
    473                     path: '/',
    474                     secure: ( 'https:' === window.location.protocol )
    475                 } );
     461                activity_oldestpage = oldest_page;
    476462                jq('#buddypress ul.activity-list').append(response.contents);
    477463
     
    18581844        } );
    18591845    }
    1860     jq.cookie( 'bp-activity-oldestpage', 1, {
    1861         path: '/',
    1862         secure: ( 'https:' === window.location.protocol )
    1863     } );
    18641846
    18651847    /* Remove selected and loading classes from tabs */
Note: See TracChangeset for help on using the changeset viewer.