Skip to:
Content

BuddyPress.org

Changeset 12016


Ignore:
Timestamp:
04/30/2018 08:48:59 AM (18 months ago)
Author:
imath
Message:

BP Nouveau: bring back Heartbeat Activities

r12002 introduced a regression in Heartbeat Activities since BP Nouveau was using the removed bp-timestamp data attribute. This data attribute is back and so is the auto-refreshing activities feature.

Fixes #7782

Location:
trunk/src/bp-templates/bp-nouveau
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/activity/entry.php

    r11899 r12016  
    1111bp_nouveau_activity_hook( 'before', 'entry' ); ?>
    1212
    13 <li class="<?php bp_activity_css_class(); ?>" id="activity-<?php bp_activity_id(); ?>" data-bp-activity-id="<?php bp_activity_id(); ?>">
     13<li class="<?php bp_activity_css_class(); ?>" id="activity-<?php bp_activity_id(); ?>" data-bp-activity-id="<?php bp_activity_id(); ?>" data-bp-timestamp="<?php bp_nouveau_activity_timestamp(); ?>">
    1414
    1515    <div class="activity-avatar item-avatar">
  • trunk/src/bp-templates/bp-nouveau/includes/activity/template-tags.php

    r12008 r12016  
    180180    do_action( 'bp_activity_entry_content' );
    181181}
     182
     183/**
     184 * Output the Activity timestamp into the bp-timestamp attribute.
     185 *
     186 * @since 3.0.0
     187 */
     188function bp_nouveau_activity_timestamp() {
     189    echo esc_attr( bp_nouveau_get_activity_timestamp() );
     190}
     191
     192    /**
     193     * Get the Activity timestamp.
     194     *
     195     * @since 3.0.0
     196     *
     197     * @return integer The Activity timestamp.
     198     */
     199    function bp_nouveau_get_activity_timestamp() {
     200        /**
     201         * Filter here to edit the activity timestamp.
     202         *
     203         * @since 3.0.0
     204         *
     205         * @param integer $value The Activity timestamp.
     206         */
     207        return apply_filters( 'bp_nouveau_get_activity_timestamp', strtotime( bp_get_activity_date_recorded() ) );
     208    }
    182209
    183210/**
  • trunk/src/bp-templates/bp-nouveau/js/buddypress-activity.js

    r12002 r12016  
    8383         */
    8484        heartbeatSend: function( event, data ) {
    85             this.heartbeat_data.first_recorded = $( '#buddypress [data-bp-list] [data-bp-activity-id] time' ).first().data( 'bp-timestamp' ) || 0;
     85            this.heartbeat_data.first_recorded = $( '#buddypress [data-bp-list] [data-bp-activity-id]' ).first().data( 'bp-timestamp' ) || 0;
    8686
    8787            if ( 0 === this.heartbeat_data.last_recorded || this.heartbeat_data.first_recorded > this.heartbeat_data.last_recorded ) {
     
    588588
    589589                        // reset vars to get newest activities when an activity is deleted
    590                         if ( ! activity_comment_id && activity_item.find( 'time' ).first().data( 'bp-timestamp' ) === parent.Activity.heartbeat_data.last_recorded ) {
     590                        if ( ! activity_comment_id && activity_item.data( 'bp-timestamp' ) === parent.Activity.heartbeat_data.last_recorded ) {
    591591                            parent.Activity.heartbeat_data.newest        = '';
    592592                            parent.Activity.heartbeat_data.last_recorded  = 0;
Note: See TracChangeset for help on using the changeset viewer.