Making WordPress.org


Ignore:
Timestamp:
07/29/2016 11:29:18 PM (8 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Prevent user from voting on their own user contributed note.

Props keesiemeijer.
See #1755.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r3664 r3753  
    132132            $GLOBALS['comment'] = $comment;
    133133            $count = (int) DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' );
    134             $comment_class = ( -1 > $count ) ? 'bad-note' : '';
     134            $curr_user_note = DevHub_User_Contributed_Notes_Voting::is_current_user_note( $comment->comment_ID );
     135
     136            $comment_class = array();
     137            if ( -1 > $count ) {
     138                $comment_class[] = 'bad-note';
     139            }
     140            if ( $curr_user_note ) {
     141                $comment_class[] = 'user-submitted-note';
     142            }
    135143            ?>
    136144
    137             <li id="comment-<?php comment_ID(); ?>" <?php comment_class( $comment_class ); ?>>
     145            <li id="comment-<?php comment_ID(); ?>" <?php comment_class( implode( ' ', $comment_class ) ); ?>>
    138146            <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    139147                <a href="#comment-content-<?php echo $comment->comment_ID; ?>" class="screen-reader-text"><?php _e( 'Skip to note content', 'wporg' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.