Making WordPress.org

Changeset 10821


Ignore:
Timestamp:
03/16/2021 02:05:35 AM (4 years ago)
Author:
dd32
Message:

Support Forums: Also Viewing: Code / warning cleanups.

  • Don't use deprecated jQuery functionality
  • Properly clear the caches when expiring some 'viewing' notifications.
  • Use a per-site, rather than per-network option for creating the table. Only affects networks with multiple sites using it.
  • Mark the option in the user profile as translatable.
Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-also-viewing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-also-viewing/wporg-bbp-also-viewing.js

    r10655 r10821  
    2020    }
    2121
    22     jQuery( document ).on( 'ready', function($) {
     22    jQuery( document ).ready( function() {
    2323        maybeDisplay();
    2424
     
    7474
    7575    // Pin the banner to the top of the screen when scrolling.
    76     jQuery(window).scroll( function() {
     76    jQuery(window).on( 'scroll', function() {
    7777        if ( ! banner ) {
    7878            return;
     
    161161        } );
    162162    } );
    163 
    164     // DEBUG. Expose the functions for testing.
    165     window.alsoViewing = {
    166         refreshViewers: refreshViewers,
    167         updateState: updateState,
    168         transmitIsTyping: transmitIsTyping,
    169         transmitNoLongerTyping: transmitNoLongerTyping,
    170     }
    171163})();
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-also-viewing/wporg-bbp-also-viewing.php

    r10662 r10821  
    200200        checked( enabled( $user_id ), true, false ),
    201201        sprintf(
    202             'Enable the <a href="%s">Also Viewing</a> feature.', // TODO: Translate once text is figured out __( , 'wporg-forums' ),
     202            __( 'Enable the <a href="%s">Also Viewing</a> feature.', 'wporg-forums' ),
    203203            'https://make.wordpress.org/support/handbook/appendix/helpful-tools/#avoiding-overlapping-replies'
    204204        )
     
    368368
    369369    foreach ( $pages as $p ) {
    370         wp_cache_delete( $page, CACHE_GROUP );
     370        wp_cache_delete( $p, CACHE_GROUP );
    371371    }
    372372}
     
    442442    global $wpdb;
    443443
    444     if ( get_site_option( 'also-viewing' ) ) {
     444    if ( get_option( 'also-viewing' ) ) {
    445445        return;
    446446    }
     
    462462    );
    463463
    464     update_site_option( 'also-viewing', true );
    465 }
     464    update_option( 'also-viewing', true );
     465}
Note: See TracChangeset for help on using the changeset viewer.