Making WordPress.org

Ticket #3572: 3572.6.patch

File 3572.6.patch, 47.5 KB (added by keesiemeijer, 7 years ago)

Add a new rule to the feedback form

  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php

     
     1<?php namespace DevHub;
     2/**
     3 * The Template for editing user contributed notes.
     4 *
     5 * This template is used if the current user can edit a note.
     6 * The global post data is set with the pre_get_posts action.
     7 *
     8 * @package wporg-developer
     9 */
     10
     11get_header();
     12
     13$comment_id = get_query_var( 'feedback_id' );
     14$comment    = get_comment( $comment_id );
     15$post       = get_queried_object();
     16$post_id    = get_queried_object_id();
     17
     18if ( ! ( $comment && $post && $post_id ) ) {
     19        // Bail if the comment or global post data is not found.
     20        include get_404_template();
     21        return;
     22}
     23
     24$is_parent   = $comment->comment_parent ?  true : false;
     25$parent      = $is_parent ? get_comment( $comment->comment_parent ) : false;
     26$post_url    = get_permalink( $post_id );
     27$post_title  = single_post_title( '', false );
     28$post_types  = get_parsed_post_types( 'labels' );
     29$type_single = get_post_type_object( $post->post_type )->labels->singular_name;
     30$type_url    = get_post_type_archive_link( $post->post_type );
     31$type_label  = $post_types[ $post->post_type ];
     32$ref_url     = get_site_section_url();
     33$ref_link    = "<a href='{$ref_url}'>Reference</a>";
     34$post_link   = "<a href='{$post_url}'>{$post_title}</a>";
     35$note_link   = "<a href='{$post_url}#comment-{$comment_id}'>note {$comment_id}</a>";
     36$type_link   = "<a href='{$type_url}'>{$type_label}</a>";
     37
     38$parent_link   = '';
     39$parent_author = '';
     40if ( $is_parent && isset( $parent->comment_ID ) ) {
     41        $parent_author = get_note_author_link( $parent );
     42        $parent_label  = sprintf( __('note %d', 'wporg'), $parent->comment_ID );
     43        $parent_link   = "<a href='{$post_url}#comment-{$parent->comment_ID}'>{$parent_label}</a>";
     44}
     45
     46add_filter( 'breadcrumb_trail_items', function($items) use ( $ref_link, $type_link, $post_link, $note_link  ) {
     47        $items[] = $ref_link;
     48        $items[] = $type_link;
     49        $items[] = $post_link;
     50        $items[] = $note_link;
     51        $items[] = __('Edit', 'wporg');
     52        return $items;
     53} );
     54?>
     55
     56        <div id="content-area" <?php body_class( 'code-reference' ); ?>>
     57
     58                <?php breadcrumb_trail( array( 'show_title' => false ) ); ?>
     59
     60                <main id="main" class="site-main" role="main">
     61
     62                        <h1><?php printf( __( 'Edit Note %d', 'wporg' ), $comment_id ); ?></h1>
     63
     64                        <p>
     65                                <?php if ( $is_parent ) : ?>
     66                                        <?php
     67                                                /* translators: 1: comment title, 2: comment author name, 3: reference type (function, class, method, hook), 4: post title */
     68                                                printf( __( 'This is a feedback note to %1$s by %2$s for the %3$s %4$s.', 'wporg' ), $parent_link, $parent_author, strtolower( $type_single ), $post_link );
     69                                        ?>
     70                                <?php else : ?>
     71                                        <?php
     72
     73                                                /* translators: 1: reference type (function, class, method, hook), 2: post title */
     74                                                printf( __( 'This is a note for the %1$s %2$s.', 'wporg' ), strtolower( $type_single ), $post_link ); ?>
     75                                <?php endif; ?>
     76
     77                                <?php echo ' ' . __( "You can edit this note as long as it's in moderation.", 'wporg' ); ?>
     78                        </p>
     79                        <?php
     80                                if ( \DevHub\can_user_edit_note( $comment_id ) ) {
     81
     82                                        if ( $is_parent ) {
     83                                                echo \DevHub_User_Submitted_Content::wp_editor_feedback( $comment, 'show', true );
     84                                        } else {
     85                                                $args = \DevHub_User_Submitted_Content::comment_form_args( $comment, 'edit');
     86                                                comment_form( $args );
     87                                        }
     88                                }
     89                        ?>
     90
     91                </main><!-- #main -->
     92        </div><!-- #primary -->
     93<?php get_footer(); ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php

     
    6464
    6565        <?php if ( \DevHub\is_parsed_post_type() && DevHub\can_user_post_note( true, get_the_ID() ) ) : ?>
    6666
    67                 <?php $add_note_style = empty( $feedback_editor ) ? 'display:none;' : ''; ?>
    68                 <p id="add-user-note" style="<?php echo $add_note_style; ?>"><a href="<?php echo user_trailingslashit( get_permalink() ) . '#respond'; ?>"><?php _e( 'Have a note or feedback to contribute?', 'wporg' ); ?></a></p>
     67                <p id="add-user-note"><a href="<?php echo user_trailingslashit( get_permalink() ) . '#respond'; ?>"><?php _e( 'Have a note or feedback to contribute?', 'wporg' ); ?></a></p>
    6968
    7069                <?php
    71                 $args = array(
    72                         'logged_in_as'        => '<p class="logged-in-as">'
    73                                 . sprintf(
    74                                         /* translators: 1: user profile link, 2: accessibility text, 3: user name, 4: logout URL */
    75                                         __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
    76                                         'https://profiles.wordpress.org/' . esc_attr( wp_get_current_user()->user_nicename ),
    77                                         /* translators: %s: user name */
    78                                         esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
    79                                         $user_identity,
    80                                         wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) )
    81                                 )
    82                                 . '</p><p><ul><li>'
    83                                 . __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' )
    84                                 . '</li><li>'
    85                                 . __( 'Feedback can be to report errors or omissions with the documentation on this page. Such feedback will not be publicly posted.', 'wporg' )
    86                                 . '</li><li>'
    87                                 /* translators: 1: php button, 2: js button, 3: inline code button */
    88                                 . sprintf(
    89                                         __( 'You can enter text and code. Use the %1$s, %2$s, or %3$s buttons to wrap code snippets.', 'wporg' ),
    90                                         '<span class="text-button">php</span>',
    91                                         '<span class="text-button">js</span>',
    92                                         '<span class="text-button">' . __( 'inline code', 'wporg' ) . '</span>'
    93                                 )
    94                                 . '</li></ul></p>',
    95                         'comment_notes_after' => '<p>'
    96                                 . __( 'Submission Notes:', 'wporg' )
    97                                 . '<ul><li>'
    98                                 . __( 'This form is not for support requests, discussions, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' )
    99                                 . '</li><li>'
    100                                 . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.', 'wporg' )
    101                                 . '</li><li class="user-notes-are-gpl">'
    102                                 . sprintf(
    103                                         /* translators: 1: GFDL link */
    104                                         __( '<strong>NOTE:</strong> All contributions are licensed under %s and are moderated before appearing on the site.', 'wporg' ),
    105                                         '<a href="https://gnu.org/licenses/fdl.html">GFDL</a>'
    106                                 )
    107                                 . '</li></ul></p>',
    108                         'label_submit'        => __( 'Add Note or Feedback', 'wporg' ),
    109                         'cancel_reply_link'   => '',
    110                         'must_log_in'         => '<p>' . sprintf(
    111                                 __( 'You must <a href="%s">log in</a> before being able to contribute a note or feedback.', 'wporg' ),
    112                                 'https://login.wordpress.org/?redirect_to=' . urlencode( get_comments_link() )
    113                         ) . '</p>',
    114                         'title_reply'         => '', //'Add Example'
    115                         'title_reply_to'      => '',
    116                 );
    117 
    118                 if ( class_exists( 'DevHub_Note_Preview' ) ) {
    119                         $args['comment_notes_after'] = DevHub_Note_Preview::comment_preview() . $args['comment_notes_after'];
    120                         $args['class_form']          = 'comment-form tab-container';
    121                 }
    122 
    123                 if ( class_exists( 'DevHub_User_Submitted_Content' ) ) {
    124                         $args['comment_field'] = DevHub_User_Submitted_Content::wp_editor_comments();
    125                 }
    126 
    12770                // Insert comment form if feedback form is not already used.
    128                 if ( empty( $feedback_editor ) ) {
     71                if ( empty( $feedback_editor ) && class_exists( 'DevHub_User_Submitted_Content' ) )  {
     72                        $args = \DevHub_User_Submitted_Content::comment_form_args();
    12973                        comment_form( $args );
    13074                }
    13175                ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php

     
    5656require __DIR__ . '/inc/user-content-voting.php';
    5757
    5858/**
     59 * Editing for user-submitted content.
     60 */
     61require __DIR__ . '/inc/user-content-edit.php';
     62
     63/**
    5964 * CLI commands custom post type and importer.
    6065 */
    6166require __DIR__ . '/inc/cli.php';
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

     
    202202                                // Feedback links to log in, add feedback or show feedback.
    203203                                echo "<footer class='feedback-links' >\n";
    204204                                if ( $can_user_post_note ) {
    205                                         echo "EEE";
    206205                                        $feedback_link = trailingslashit( get_permalink() ) . "?replytocom={$comment_id}#feedback-editor-{$comment_id}";
    207206                                        $display       = '';
    208207                                        $aria          = '';
     
    243242                        $approved       = ( 0 < (int) $comment->comment_approved ) ? true : false;
    244243                        $is_parent      = ( 0 === (int) $comment->comment_parent ) ? true : false;
    245244                        $is_voting      = class_exists( 'DevHub_User_Contributed_Notes_Voting' );
     245                        $is_edit        = class_exists( 'DevHub_User_Content_Edit' );
    246246                        $count          = $is_voting ? (int)  DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' ) : 0;
    247247                        $curr_user_note = $is_voting ? (bool) DevHub_User_Contributed_Notes_Voting::is_current_user_note( $comment->comment_ID ) : false;
     248                        $edited_note_id = $is_edit ? DevHub_User_Content_Edit::get_edited_note() : 0;
     249                        $is_edited_note = $edited_note_id && ( (int) $comment->comment_ID === $edited_note_id );
     250                        $note_author    = \DevHub\get_note_author_link( $comment );
     251                        $can_edit_note  = \DevHub\can_user_edit_note( $comment->comment_ID );
     252                        $has_edit_cap   = current_user_can( 'edit_comment', $comment->comment_ID );
    248253
    249                         // Classes
     254                        // CSS Classes
    250255                        $comment_class = array();
    251256
    252257                        if ( -1 > $count ) {
     
    261266                                $comment_class[] = 'user-note-moderated';
    262267                        }
    263268
    264                         // This would all be moot if core passed the $comment context for 'get_comment_author_link' filter.
    265                         if ( $comment->user_id ) {
    266                                 $commenter = get_user_by( 'id', $comment->user_id );
    267                                 $url = 'https://profiles.wordpress.org/' . sanitize_key( $commenter->user_nicename ) . '/';
    268                                 $author = get_the_author_meta( 'display_name', $comment->user_id );
    269                         } else {
    270                                 $url = $comment->comment_author_url;
    271                                 $author = $comment->comment_author;
    272                         }
    273 
    274                         $comment_author_link = $author;
    275                         if ( $url ) {
    276                                 $comment_author_link = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
    277                         }
    278 
    279269                        $date = sprintf( _x( '%1$s ago', '%1$s = human-readable time difference', 'wporg' ),
    280270                                human_time_diff( get_comment_time( 'U' ),
    281271                                current_time( 'timestamp' ) )
     
    300290                                                        echo get_avatar( $comment, $args['avatar_size'] );
    301291                                                }
    302292
    303                                                 printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) );
     293                                                printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $note_author ) );
    304294                                                ?>
    305295
    306296                                                </span>
    307297                                                &mdash;
    308                                                 <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
     298                                                <a class="comment-date" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
    309299                                                        <time datetime="<?php comment_time( 'c' ); ?>">
    310300                                                        <?php echo $date; ?>
    311301                                                        </time>
    312302                                                </a>
    313303                                                <?php edit_comment_link( __( 'Edit', 'wporg' ), '<span class="edit-link">&mdash; ', '</span>' ); ?>
     304                                                <?php if ( ! $has_edit_cap && $can_edit_note ) : ?>
     305                                                        &mdash; <span class="comment-author-edit-link">
     306                                                                <a class="comment-edit-link" href="<?php echo site_url( "/reference/comment/edit/{$comment->comment_ID}" ); ?>"><?php _e( 'Edit', 'wporg' ); ?></a>
     307                                                        </span>
     308                                                <?php endif; ?>
     309                                                <?php if ( $can_edit_note && $is_edited_note ) : ?>
     310                                                        &mdash; <span class="comment-edited">
     311                                                        <?php _e( 'edited', 'wporg' ); ?>
     312                                                        </span>
     313                                                <?php endif; ?>
    314314                                                <?php if ( ! $approved ) : ?>
    315315                                                        &mdash; <span class="comment-awaiting-moderation"><?php _e( 'awaiting moderation', 'wporg' ); ?></span>
    316316                                                <?php endif; ?>
     
    325325                                        comment_text();
    326326                                } else {
    327327                                        $text = get_comment_text()  . ' &mdash; ';
    328                                         $text .= sprintf( __( 'By %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) ) . ' &mdash; ';
    329                                         $text .= ' <a href="'. esc_url( get_comment_link( $comment->comment_ID ) ) . '">';
     328                                        $text .= sprintf( __( 'By %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $note_author ) ) . ' &mdash; ';
     329                                        $text .= ' <a class="comment-date" href="'. esc_url( get_comment_link( $comment->comment_ID ) ) . '">';
    330330                                        $text .= '<time datetime="' . get_comment_time( 'c' ) . '">' . $date . '</time></a>';
    331331
    332                                         if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
     332                                        if ( $has_edit_cap ) {
    333333                                                $text .= ' &mdash; <a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) .'">';
    334334                                                $text .= __( 'Edit', 'wporg' ) . '</a>';
     335                                        } elseif ( $can_edit_note ) {
     336                                                $text .= ' &mdash; <a class="comment-edit-link" href="' . site_url( "/reference/comment/edit/{$comment->comment_ID}" ) . '">';
     337                                                $text .= __( 'Edit', 'wporg' ) . '</a>';
    335338                                        }
    336339
     340                                        if( $can_edit_note && $is_edited_note ) {
     341                                                $text .= ' &mdash; <span class="comment-edited">' . __( 'edited', 'wporg' ) . '</span>';
     342                                        }
     343
    337344                                        if ( ! $approved ) {
    338345                                                $text .= ' &mdash; <span class="comment-awaiting-moderation">' . __( 'awaiting moderation', 'wporg' ) . '</span>';
    339346                                        }
     
    13971404        }
    13981405
    13991406        /**
     1407         * Indicates if the current user can edit a user contibuted note.
     1408         *
     1409         * A user can edit a note if the note is from a parsed post type, and
     1410         *     the note is from the current user and it's not yet approved.
     1411         *     Or if the user has the 'edit_comment' capability.
     1412         *
     1413         * @param integer $note_id Note ID.
     1414         * @return bool True if the current user can edit the note.
     1415         */
     1416        function can_user_edit_note( $note_id = 0 ) {
     1417                $user = get_current_user_id();
     1418                $note = get_comment( $note_id );
     1419                if ( ! $user || ! $note ) {
     1420                        return false;
     1421                }
     1422
     1423                $post_id        = isset( $note->comment_post_ID ) ? (int) $note->comment_post_ID : 0;
     1424                $is_note_author = isset( $note->user_id ) && ( (int) $note->user_id === $user );
     1425                $is_approved    = isset( $note->comment_approved ) && ( 0 < (int) $note->comment_approved );
     1426                $can_edit_notes = isset( $note->comment_ID ) && current_user_can( 'edit_comment', $note->comment_ID );
     1427                $is_parsed_type = is_parsed_post_type( get_post_type( $post_id ) );
     1428
     1429                if ( $is_parsed_type && ( $can_edit_notes || ( $is_note_author && ! $is_approved ) ) ) {
     1430                        return true;
     1431                }
     1432
     1433                return false;
     1434        }
     1435
     1436        /**
     1437         * Get the note author link to the profiles.wordpress.org author's URL.
     1438         *
     1439         * @param WP_Comment|int $comment Comment object or comment ID.
     1440         * @return string The HTML link to the profiles.wordpress.org author's URL.
     1441         */
     1442        function get_note_author_link( $comment ) {
     1443                return get_note_author( $comment, true );
     1444        }
     1445
     1446        /**
     1447         * Get the note author nicename.
     1448         *
     1449         * @param WP_Comment|int $comment Comment object or comment ID.
     1450         * @param bool           $link. Whether to return a link to the author's profiles. Default false.
     1451         * @return string The comment author name or HTML link.
     1452         */
     1453        function get_note_author( $comment, $link = false ) {
     1454                $comment   = get_comment( $comment );
     1455                $user_id   = isset( $comment->user_id ) ? $comment->user_id : 0;
     1456                $commenter = get_user_by( 'id', $comment->user_id );
     1457                $author    = '';
     1458
     1459                if ( $user_id && isset( $commenter->user_nicename ) ) {
     1460                        $url    = 'https://profiles.wordpress.org/' . sanitize_key( $commenter->user_nicename ) . '/';
     1461                        $author = get_the_author_meta( 'display_name', $comment->user_id );
     1462                } else {
     1463                        $url    = isset( $comment->comment_author_url ) ?  $comment->comment_author_url : '';
     1464                        $author = isset( $comment->comment_author ) ?  $comment->comment_author : '';
     1465                }
     1466
     1467                if ( $link && ( $url && $author ) ) {
     1468                        $author = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
     1469                }
     1470
     1471                return $author;
     1472        }
     1473
     1474        /**
    14001475         * Gets the summary.
    14011476         *
    14021477         * The summary (aka short description) is stored in the 'post_excerpt' field.
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-edit.php

     
     1<?php
     2/**
     3 * Code Reference edit user submitted content (comments, notes, etc).
     4 *
     5 * @package wporg-developer
     6 */
     7
     8/**
     9 * Class to handle editing user submitted content.
     10 */
     11class DevHub_User_Content_Edit {
     12
     13        private static $updated_note = 0;
     14
     15        /**
     16         * Initializer
     17         */
     18        public static function init() {
     19                add_action( 'init', array( __CLASS__, 'do_init' ) );
     20        }
     21
     22        /**
     23         * Handles adding/removing hooks to enable editing comments.
     24         * Adds rewrite rules for editing comments in the front end.
     25         */
     26        public static function do_init() {
     27                // Add the edit comment rewrite rule
     28                add_rewrite_rule( 'reference/comment/edit/([0-9]{1,})/?$', 'index.php?feedback_id=$matches[1]', 'top' );
     29
     30                // Add feedback_id query var for editing.
     31                add_filter( 'query_vars',                      array( __CLASS__, 'comment_query_var' ) );
     32
     33                // Redirect to home page is the edit request is invalid.
     34                add_action( 'template_redirect',               array( __CLASS__, 'redirect_invalid_edit_request' ) );
     35
     36                // Include the edit template.
     37                add_filter( 'template_include',                array( __CLASS__, 'template_include' ) );
     38
     39                // Set the post_type and post for the edit request.
     40                add_action( 'pre_get_posts',                   array( __CLASS__, 'pre_get_posts' ) );
     41
     42                // Update the comment.
     43                add_action( 'wp', array( __CLASS__, 'update_comment' ) );
     44        }
     45
     46        /**
     47         * Get the note ID that was edited.
     48         *
     49         * @return int Note ID that was edited or 0.
     50         */
     51        public static function get_edited_note() {
     52                return self::$updated_note ? (int) self::$updated_note : 0;
     53        }
     54
     55        /**
     56         * Add feedback_id to the public query vars.
     57         *
     58         * @param array $query_vars Array with public query vars.
     59         * @return array Public query vars.
     60         */
     61        public static function comment_query_var( $query_vars ) {
     62                $query_vars[] = 'feedback_id';
     63                return $query_vars;
     64        }
     65
     66        /**
     67         * Update a comment after editing.
     68         *
     69         */
     70        public static function update_comment() {
     71                self::$updated_note = 0;
     72
     73                if ( ! is_single() || ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) ) {
     74                        return;
     75                }
     76
     77                $comment_data = wp_unslash( $_POST );
     78
     79                $defaults = array(
     80                        'edit_contributed_note',
     81                        '_wpnonce',
     82                        'comment_ID',
     83                        'comment',
     84                        'comment_parent',
     85                        'comment_post_ID'
     86                );
     87
     88                foreach ( $defaults as $value ) {
     89                        if ( ! isset( $comment_data[ $value ] ) ) {
     90                                // Return if any of the default values is missing.
     91                                return;
     92                        }
     93                }
     94
     95                $action   = 'update-note_' . $comment_data['comment_ID'];
     96                $verified = wp_verify_nonce( $comment_data['_wpnonce'], $action );
     97
     98                if ( $verified && DevHub\can_user_edit_note( (int) $comment_data['comment_ID'] ) ) {
     99                        self::$updated_note = (int) $comment_data['comment_ID'];
     100                        $comment = trim( (string) $comment_data['comment'] );
     101                        $comment_data['comment_content'] = $comment;
     102                        wp_update_comment( $comment_data );
     103                }
     104        }
     105
     106        /**
     107         * Use the 'comments-edit.php' template for editing comments.
     108         *
     109         * @param string $template Template to include.
     110         * @return string           Template to include.
     111         */
     112        public static function template_include( $template ) {
     113                $comment = get_query_var( 'feedback_id' );
     114                if ( ! $comment ) {
     115                        return $template;
     116                }
     117
     118                $comment_template = get_query_template( "comments-edit" );
     119                if ( $comment_template ) {
     120                        $template = $comment_template;
     121                }
     122                return $template;
     123        }
     124
     125        /**
     126         * Redirects to the home page if the edit request is invalid for the current user.
     127         *
     128         * Redirects if the current user is not the comment author.
     129         * Redirects if the comment doesn't exist.
     130         * Redirects if the comment is not for a parsed post type.
     131         * Redirects if a comment is already approved.
     132         *
     133         * Doesn't redirect for users with the edit_comment capability.
     134         */
     135        public static function redirect_invalid_edit_request() {
     136                $comment_id = absint( get_query_var( 'feedback_id' ) );
     137                if ( ! $comment_id ) {
     138                        return;
     139                }
     140
     141                if ( !  DevHub\can_user_edit_note( $comment_id ) ) {
     142                        // Redirect if you're not the comment author.
     143                        wp_redirect( home_url() );
     144                        exit();
     145                }
     146        }
     147
     148        /**
     149         * Set's the post and post type for the edit request.
     150         *
     151         * Trows a 404 if the current user can't edit the requested note.
     152         *
     153         * @param WP_Query $query The WP_Query instance (passed by reference)
     154         */
     155        public static function pre_get_posts( $query ) {
     156                if ( ! ( $query->is_main_query() && $query->get( 'feedback_id' ) ) ) {
     157                        // Not a query for editing a note.
     158                        return;
     159                }
     160
     161                $comment_id = $query->get( 'feedback_id' );
     162
     163                if (  DevHub\can_user_edit_note( $comment_id ) ) {
     164                        $comment = get_comment( $comment_id );
     165                        if ( isset( $comment->comment_post_ID ) ) {
     166                                $query->is_singular = true;
     167                                $query->is_single = true;
     168                                $query->set( 'post_type', get_post_type( $comment->comment_post_ID ) );
     169                                $query->set( 'p', $comment->comment_post_ID );
     170                        } else {
     171                                $query->set_404();
     172                        }
     173                } else {
     174                        $query->set_404();
     175                }
     176        }
     177
     178} // DevHub_User_Content_Edit
     179
     180DevHub_User_Content_Edit::init();
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php

     
    5050                remove_filter( 'comment_text',                 'capital_P_dangit',   31 );
    5151
    5252                // Enable shortcodes for comments
    53                 add_filter( 'comment_text',                    'do_shortcode');
     53                add_filter( 'comment_text',                    'do_shortcode' );
    5454
    5555                // Customize allowed tags
    5656                add_filter( 'wp_kses_allowed_html',            array( __CLASS__, 'wp_kses_allowed_html' ), 10, 2 );
     
    6767                // Allowed HTML for an edited child comment (There is no decent hook to filter child comments only)
    6868                add_action( 'edit_comment',                    array( __CLASS__, 'comment_edit_allowed_html' ) );
    6969
     70                // Adds hidden fields for editing to a comment form
     71                add_filter( 'comment_form_submit_field',       array( __CLASS__, 'add_hidden_fields' ), 10, 2 );
    7072        }
    7173
    7274        /**
     
    167169                        wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array( 'jquery', 'quicktags' ), '20180323', true );
    168170                        wp_enqueue_script( 'wporg-developer-user-notes-feedback', get_template_directory_uri() . '/js/user-notes-feedback.js', array( 'jquery', 'quicktags' ), '20180323', true );
    169171                        wp_localize_script( 'wporg-developer-user-notes-feedback', 'wporg_note_feedback', array(
    170                                 'show' => __( 'Show Feedback', 'wporg' ),
    171                                 'hide' => __( 'Hide Feedback', 'wporg' ),
    172                         ) );
     172                                        'show' => __( 'Show Feedback', 'wporg' ),
     173                                        'hide' => __( 'Hide Feedback', 'wporg' ),
     174                                ) );
    173175                }
    174176        }
    175177
     
    176178        /**
    177179         * Sets the default language for SyntaxHighlighter shortcode.
    178180         *
    179          * @param  array $atts Shortcode attributes.
     181         * @param array $atts Shortcode attributes.
    180182         * @return array
    181183         */
    182184        public static function syntaxhighlighter_shortcodeatts( $atts ) {
     
    187189        /**
    188190         * Subverts capital_P_dangit for SyntaxHighlighter shortcode.
    189191         *
    190          * @param  string $code
     192         * @param string $code
    191193         * @return string
    192194         */
    193195        public static function syntaxhighlighter_precode( $code ) {
     
    195197        }
    196198
    197199        /**
     200         * Add hidden fields to the comment form if the context is 'edit'
     201         *
     202         * @param string $submit_field HTML string with the submit button fields.
     203         * @param array  $args         Arguments for the comment form.
     204         * @return HTML string with the submit button fields.
     205         */
     206        public static function add_hidden_fields( $submit_field, $args ) {
     207                $context = isset( $args['context'] ) ? $args['context'] : '';
     208                $comment = isset( $args['comment_edit'] ) ? $args['comment_edit'] : false;
     209                if ( ! ( $comment && ( 'edit' === $context ) ) ) {
     210                        return $submit_field;
     211                }
     212
     213                $comment_id = isset( $comment->comment_ID ) ? $comment->comment_ID : 0;
     214
     215                return $submit_field . self::get_edit_fields( $comment_id, $instance = 0 );
     216        }
     217
     218        /**
     219         * Get the comment form arguments by context.
     220         *
     221         * @param WP_Comment|false $comment Comment object or false. Default false.
     222         * @param string           $context Context of arguments. Accepts 'edit' or empty string.
     223         * @return array Array with comment form arguments.
     224         */
     225        public static function comment_form_args( $comment = false, $context = '' ) {
     226                $label = _x( 'Add Note or Feedback', 'noun', 'wporg' );
     227                if ( 'edit' === $context ) {
     228                        $label = _x( 'Edit Note', 'noun', 'wporg' );
     229                }
     230
     231                $args = array(
     232                        'logged_in_as'        => '<p class="logged-in-as">'
     233                        . sprintf(
     234                                /* translators: 1: user profile link, 2: accessibility text, 3: user name, 4: logout URL */
     235                                __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
     236                                'https://profiles.wordpress.org/' . esc_attr( wp_get_current_user()->user_nicename ),
     237                                /* translators: %s: user name */
     238                                esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
     239                                $user_identity,
     240                                wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) )
     241                        )
     242                        . '</p><p><ul><li>'
     243                        . __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' )
     244                        . '</li><li>'
     245                        . __( 'Feedback can be to report errors or omissions with the documentation on this page. Such feedback will not be publicly posted.', 'wporg' )
     246                        . '</li><li>'
     247                        /* translators: 1: php button, 2: js button, 3: inline code button */
     248                        . sprintf(
     249                                __( 'You can enter text and code. Use the %1$s, %2$s, or %3$s buttons to wrap code snippets.', 'wporg' ),
     250                                '<span class="text-button">php</span>',
     251                                '<span class="text-button">js</span>',
     252                                '<span class="text-button">' . __( 'inline code', 'wporg' ) . '</span>'
     253                        )
     254                        . '</li></ul></p>',
     255                        'comment_notes_after' => '<p>' . __( 'Submission Notes:', 'wporg' ) . '</p>' . self::get_editor_rules(),
     256                        'label_submit'        => $label,
     257                        'cancel_reply_link'   => '',
     258                        'must_log_in'         => '<p>' . sprintf(
     259                                __( 'You must <a href="%s">log in</a> before being able to contribute a note or feedback.', 'wporg' ),
     260                                'https://login.wordpress.org/?redirect_to=' . urlencode( get_comments_link() )
     261                        ) . '</p>',
     262                        'title_reply'         => '', //'Add Example'
     263                        'title_reply_to'      => '',
     264                );
     265
     266                if ( class_exists( 'DevHub_Note_Preview' ) ) {
     267                        $args['comment_notes_after'] = DevHub_Note_Preview::comment_preview() . $args['comment_notes_after'];
     268                        $args['class_form']          = "comment-form tab-container";
     269                }
     270
     271                $args['comment_field'] = self::wp_editor_comments( $label, $comment );
     272                $args['context'] = $context;
     273                $args['comment_edit'] = $comment;
     274
     275                if ( $comment && ( 'edit' === $context ) ) {
     276                        $comment_id = isset( $comment->comment_ID ) ? $comment->comment_ID : 0;
     277                        $post_id    = isset( $comment->comment_post_ID ) ? $comment->comment_post_ID : 0;
     278
     279                        $args['action'] = get_permalink( $post_id ) . '#comment-' . $comment_id;
     280                }
     281
     282                return $args;
     283        }
     284
     285        /**
    198286         * Capture an {@see wp_editor()} instance as the 'User Contributed Notes' comment form.
    199287         *
    200288         * Uses output buffering to capture the editor instance for use with the {@see comments_form()}.
    201289         *
     290         * @param string           $label   Label used for the editor.
     291         * @param WP_Comment|false $comment Comment object or false. Default false.
    202292         * @return string HTML output for the wp_editor-ized comment form.
    203293         */
    204         public static function wp_editor_comments() {
     294        public static function wp_editor_comments( $label, $comment = false ) {
     295                $content = isset( $comment->comment_content ) ? $comment->comment_content : '';
     296
    205297                ob_start();
    206                 echo '<h3><label for="comment">' . _x( 'Add Note or Feedback', 'noun', 'wporg' ) . '</label></h3>';
     298                echo '<h3><label for="comment">' . $label . '</label></h3>';
    207299
    208300                if ( class_exists( 'DevHub_Note_Preview' ) ) {
    209                         echo '<ul class="tablist" style="display:none;">';
     301                        echo "<ul class='tablist' style='display: none;'>";
    210302                        echo '<li><a href="#comment-form-comment">' . __( 'Write', 'wporg' ) . '</a></li>';
    211303                        echo '<li><a href="#comment-preview">' . __( 'Preview', 'wporg' ) . '</a></li></ul>';
    212304                }
    213305
    214                 $style = '<style type="text/css">';
    215                 ob_start();
    216                 include get_stylesheet_directory() . '/stylesheets/editor-style.css';
    217                 $style .= ob_get_clean();
    218                 $style .=' </style>';
    219 
    220306                echo '<div class="comment-form-comment tab-section" id="comment-form-comment">';
    221                 wp_editor( '', 'comment', array(
    222                         'media_buttons' => false,
    223                         'editor_css'    => $style,
    224                         'textarea_name' => 'comment',
    225                         'textarea_rows' => 8,
    226                         'quicktags'     => array(
    227                                 'buttons' => 'strong,em,ul,ol,li'
    228                         ),
    229                         'teeny'         => true,
    230                         'tinymce'       => false,
    231                 ) );
     307                wp_editor( $content, 'comment', array(
     308                                'media_buttons' => false,
     309                                'editor_css'    => self::get_editor_style(),
     310                                'textarea_name' => 'comment',
     311                                'textarea_rows' => 8,
     312                                'quicktags'     => array(
     313                                        'buttons' => 'strong,em,ul,ol,li'
     314                                ),
     315                                'teeny'         => true,
     316                                'tinymce'       => false,
     317                        ) );
    232318                echo '</div>';
    233319                return ob_get_clean();
    234320        }
     
    238324         *
    239325         * Uses output buffering to capture the editor instance.
    240326         *
     327         * @param WP_Comment|false $comment Comment object or false. Default false.
     328         * @param string           $display Display the editor. Default 'show'.
     329         * @param bool             $edit    True if the editor used for editing a note. Default false.
    241330         * @return string HTML output for the wp_editor-ized feedback form.
    242331         */
    243         public static function wp_editor_feedback( $comment, $display = 'show', $content = '' ) {
     332        public static function wp_editor_feedback( $comment, $display = 'show', $edit = false ) {
    244333
    245334                if ( ! ( isset( $comment->comment_ID ) && absint( $comment->comment_ID ) ) ) {
    246335                        return '';
     
    251340                static $instance = 0;
    252341                $instance++;
    253342
    254                 $display     = ( 'hide' === $display ) ? ' style="display: none;"' : '';
    255                 $title       = __( 'Add feedback to this note', 'wporg' );
    256                 $form_type   = '';
    257                 $button_text = __( 'Add Feedback', 'wporg' );
     343                $display       = ( 'hide' === $display ) ? ' style="display: none;"' : '';
     344                $parent        = $comment_id;
     345                $action        = site_url( '/wp-comments-post.php' );
     346                $content       = '';
     347                $title         = __( 'Add feedback to this note', 'wporg' );
     348                $form_type     = '';
     349                $button_text   = __( 'Add Feedback', 'wporg' );
     350                $post_id       = isset( $comment->comment_post_ID ) ? $comment->comment_post_ID : get_the_ID();
     351                $note_link     = '';
    258352
    259                 if ( $content ) {
     353                if ( $edit ) {
     354                        $content     = isset( $comment->comment_content ) ? $comment->comment_content : '';
    260355                        $title       = __( 'Edit feedback', 'wporg' );
    261356                        $form_type   = '-edit';
    262                         $button_text = __( 'Edit Feedback', 'wporg' );
     357                        $button_text = __( 'Edit Note', 'wporg' );
     358                        $action      = get_permalink( $post_id ) . '#comment-' . $comment_id;
     359
     360                        $parent        = isset( $comment->comment_parent ) ? $comment->comment_parent : 0;
     361                        $parent_url    = get_permalink( $post_id ) . '#comment-' . $parent;
     362                        $parent_author = \DevHub\get_note_author( $parent );
     363                        $parent_note   = sprintf( __( 'note %d', 'wporg' ), $parent );
     364       
     365                        /* translators: 1: note, 2: note author name */
     366                        $note_link = sprintf( __( '%1$s by %2$s', 'wporg' ), "<a href='{$parent_url}'>{$parent_note}</a>", $parent_author );
    263367                }
    264368
    265369                $allowed_tags = '';
     
    269373
    270374                ob_start();
    271375                echo "<div id='feedback-editor-{$comment_id}' class='feedback-editor'{$display}>\n";
    272                 echo "<p class='feedback-editor-title'>{$title}</p>\n";
    273                 echo '<form id="feedback-form-' . $instance . $form_type . '" class="feedback-form" method="post" action="' . site_url( '/wp-comments-post.php' ) . '" name="feedback-form-' . $instance ."\">\n";
     376                if ( ! $edit ) {
     377                        echo "<p class='feedback-editor-title'>{$title}</p>\n";
     378                }
    274379
    275                 wp_editor( '', 'feedback-' . $instance, array(
    276                         'media_buttons' => false,
    277                         'textarea_name' => 'comment',
    278                         'textarea_rows' => 3,
    279                         'quicktags'     => array(
    280                                 'buttons' => 'strong,em'
    281                         ),
    282                         'teeny'         => true,
    283                         'tinymce'       => false,
    284                 ) );
     380                echo "<form id='feedback-form-{$instance}{$form_type}' class='feedback-form' method='post' action='{$action}' name='feedback-form-{$instance}'>\n";
     381                echo self::get_editor_rules( 'feedback', $note_link );
     382                wp_editor( $content, 'feedback-' . $instance, array(
     383                                'media_buttons' => false,
     384                                'textarea_name' => 'comment',
     385                                'textarea_rows' => 3,
     386                                'quicktags'     => array(
     387                                        'buttons' => 'strong,em'
     388                                ),
     389                                'editor_css'    => self::get_editor_style(),
     390                                'teeny'         => true,
     391                                'tinymce'       => false,
     392                        ) );
    285393
    286394                echo '<p><strong>' . __( 'Note', 'wporg' ) . '</strong>: ' . __( 'No newlines allowed', 'wporg' ) . '. ';
    287395                printf( __( 'Allowed tags: %s', 'wporg' ), trim( $allowed_tags, ', ' ) ) . "</p>\n";
    288                 echo "<p><input id='submit-{$instance}' class='submit' type='submit' value='Add Feedback' name='submit-{$instance}'>\n";
    289                 echo "<input type='hidden' name='comment_post_ID' value='" . get_the_ID() . "' id='comment_post_ID-{$instance}' />\n";
    290                 echo "<input type='hidden' name='comment_parent' id='comment_parent-{$instance}' value='{$comment_id}' />\n";
     396                echo "<p><input id='submit-{$instance}' class='submit' type='submit' value='{$button_text}' name='submit-{$instance}'>\n";
     397                echo "<input type='hidden' name='comment_post_ID' value='{$post_id}' id='comment_post_ID-{$instance}' />\n";
     398                echo "<input type='hidden' name='comment_parent' id='comment_parent-{$instance}' value='{$parent}' />\n";
     399
     400                if ( $edit ) {
     401                        echo self::get_edit_fields( $comment_id, $instance );
     402                }
     403
    291404                echo "</p>\n</form>\n</div><!-- #feedback-editor-{$comment_id} -->\n";
    292405                return ob_get_clean();
    293406        }
    294407
     408        /**
     409         * Get the rules list for the comment form.
     410         *
     411         * @param string $context Accepts 'feedback' or empty sring
     412         * @return string Editor rules.
     413         */
     414        function get_editor_rules( $context = '', $note_link = '' ) {
     415                $license_rule = sprintf(
     416                                /* translators: 1: GFDL link */
     417                                __( '<strong>NOTE:</strong> All contributions are licensed under %s and are moderated before appearing on the site.', 'wporg' ),
     418                                '<a href="https://gnu.org/licenses/fdl.html">GFDL</a>'
     419                        );
     420
     421                if ( 'feedback' === $context ) {
     422                        $feedback_rule = __( 'Use this form to report errors or to add additional information to this note.', 'wporg' );
     423                        if ( $note_link ) {
     424                                $feedback_rule = sprintf( __( 'Use this form to report errors or to add additional information to %s.', 'wporg' ), $note_link );
     425                        }
     426
     427                        return '<ul><li>'
     428                                . __( 'Feedback is part of the documentation.', 'wporg' ) . ' '
     429                                . $feedback_rule
     430                                . '</li><li>'
     431                                . __( 'This form is not for support requests, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' )
     432                                . '</li><li class="user-notes-are-gpl">'
     433                                . $license_rule
     434                                . '</li></ul>';
     435                }
     436
     437                return '<ul><li>'
     438                        . __( 'This form is not for support requests, discussions, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' )
     439                        . '</li><li>'
     440                        . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.', 'wporg' )
     441                        . '</li><li class="user-notes-are-gpl">'
     442                        . $license_rule
     443                        . '</li></ul>';
     444        }
     445
     446        /**
     447         * Get the editor styles.
     448         *
     449         * @return string Editor styles.
     450         */
     451        function get_editor_style() {
     452                $style = '<style type="text/css">';
     453                ob_start();
     454                include get_stylesheet_directory() . '/stylesheets/editor-style.css';
     455                $style .= ob_get_clean();
     456                $style .= ' </style>';
     457                return $style;
     458        }
     459
     460        /**
     461         * Get the hidden input fields HTML used when editing.
     462         *
     463         * @param int     $comment_id Comment ID.
     464         * @param integer $instance   Comment form instance number used in HTML id's.
     465         * @return string Hidden input fields HTML.
     466         */
     467        function get_edit_fields( $comment_id, $instance = 0 ) {
     468                $fields = "<input type='hidden' name='comment_ID' id='comment_ID-{$instance}' value='{$comment_id}' />\n";
     469                $fields .= "<input type='hidden' name='edit_contributed_note' id='edit_note_feedback-{$instance}' value='1' />\n";
     470                $fields .= wp_nonce_field( 'update-note_' . $comment_id, '_wpnonce', true, false );
     471
     472                return $fields;
     473        }
     474
    295475} // DevHub_User_Submitted_Content
    296476
    297477DevHub_User_Submitted_Content::init();
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-feedback.js

     
    44                return;
    55        }
    66
     7        var wpAdminBar     = 0;
    78        var options        = wporg_note_feedback;
    8         var wpAdminBar     = $('#page.admin-bar').length ? 32 : 0;
    99        var feedbackToggle = $( '<a class="feedback-toggle" href="#">' + options.show + '</a>' );
    1010        var hash           = window.location.hash;
    1111
     
    7878
    7979        // Show hidden child comments if the fragment identifier is a comment ID (e.g. #comment-63). 
    8080        $( document ).ready( function() {
    81 
     81                wpAdminBar = $('#wpadminbar').length ? 32 : 0
    8282                var childComments = $( '.comment' ).find( 'ul.children' );
    8383
    84                 if ( !( hash.length && childComments.length ) ) {
     84                if ( ! ( hash.length && childComments.length ) ) {
    8585                        return;
    8686                }
    8787
    88                 var hashComment = childComments.find( hash ).first();
    89                 if ( hashComment.length ) {
    90                         // Child comment exists.
     88                var hashComment = childComments.find( hash + '.depth-2' ).first();
     89                if ( ! hashComment.length ) {
     90                        return;
     91                }
     92                // Child comment exists.
    9193
    92                         var parent = hashComment.closest( '.comment.depth-1' );
    93                         if ( parent.find( '.feedback' ).hasClass( 'hide-if-js' ) ) {
    94                                 // Show child comments.
    95                                 parent.find( '.feedback-toggle' ).first().trigger( 'click' );
    96                         }
     94                var parent = hashComment.closest( '.comment.depth-1' );
     95                if ( parent.find( '.feedback' ).hasClass( 'hide-if-js' ) ) {
     96                        // Show child comments.
     97                        parent.find( '.feedback-toggle' ).first().trigger( 'click' );
     98                }
    9799
    98                         // Scroll to the child comment.
    99                         var pos = hashComment.offset();
    100                         $( 'html,body' ).animate( {
    101                                 scrollTop: pos.top - wpAdminBar
    102                         }, 1 );
    103                 }
     100                // Scroll to child comment and adjust for admin bar
     101                var pos = hashComment.offset();
     102                $( 'html,body' ).animate( {
     103                        scrollTop: pos.top - wpAdminBar
     104                }, 1 );
     105
    104106        } );
    105107
    106108        // Show/Hide feedback toggle link.
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-preview.js

     
    2020                text = '';
    2121                processing = false;
    2222
     23                // Show tabs with Javascript.
     24                $( '#commentform .tablist').show();
     25
    2326                if ( textarea.length && preview.length && tabs.length ) {
    2427
    2528                        // Append spinner to preview tab
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js

     
    55
    66( function( $ ) {
    77
    8         var commentForm = $( '.comment-form textarea' );
     8        var commentForm = $( '.comment-form textarea' );       
     9        var hash = window.location.hash;
     10        var wpAdminBar = 0;
    911
    10         if ( !commentForm.length ) {
    11                 return;
     12        // Check if the fragment identifier is a comment ID (e.g. #comment-63)
     13        if ( ! hash.match( /#comment\-[0-9]+$/ ) ) {
     14                hash = '';
    1215        }
    1316
     17        // Scroll to top level comments
     18        $( document ).ready( function() {
     19                wpAdminBar = $( '#wpadminbar' ).length ? 32 : 0;
     20                if( ! wpAdminBar || ! hash ) {
     21                        return;
     22                }
     23
     24                var hashComment = $('#comments').find( hash + '.depth-1' ).first();
     25                if( ! hashComment.length  ) {
     26                        return;
     27                }
     28
     29                // Scroll to top level comment and adjust for admin bar.
     30                var pos = hashComment.offset();
     31                $( 'html,body' ).animate( {
     32                        scrollTop: pos.top - wpAdminBar
     33                }, 1 );
     34        } );
     35
     36        // Scroll to comment if comment date link is clicked
     37        $( '#comments' ).on( 'click', '.comment-date', function( e ) {
     38                e.preventDefault();
     39
     40                // Scroll to comment and adjust for admin bar
     41                // Add 16px for child comments
     42                var pos = $( this ).offset();
     43                $( 'html,body' ).animate( {
     44                        scrollTop: pos.top - wpAdminBar - 16
     45                }, 1 );
     46        } );
     47
    1448        function showCommentForm() {
     49                $( '#add-user-note' ).hide();
    1550                $( '#respond' ).show();
    16                 $( '#add-user-note' ).hide();
    1751
    18                 var wpAdminBar = $( '#page.admin-bar' ).length ? 32 : 0;
    1952                var target     = $( '#commentform #add-note-or-feedback' );
    2053                if ( target.length ) {
    2154                        var pos = target.offset();
     
    2861                }
    2962        }
    3063
    31         $( '#respond, #add-user-note' ).toggle();
     64        if ( ! commentForm.length ) {
     65                return;
     66        }
     67
     68        if( $('#add-user-note').length ) {
     69                // Hide by default if #add-user-note exists
     70                $( '#respond' ).hide();
     71        }
     72
    3273        $( '#add-user-note, .table-of-contents a[href="#add-note-or-feedback"]' ).click( function( e ) {
    3374                e.preventDefault();
    3475
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss

     
    11371137                        opacity: 1;
    11381138                }
    11391139
    1140                 .comment-awaiting-moderation {
     1140                .comment-awaiting-moderation,
     1141                .comment-edited {
    11411142                        background-color: #fff8e5;
    11421143                        padding: .2em .5em;
     1144                        margin-right: .5em;
    11431145                        border-radius: 3px;
    11441146                        border: 1px solid #ffb900;
    11451147                }
    11461148
    1147                 .depth-2 .comment-awaiting-moderation {
     1149                .depth-2 .comment-awaiting-moderation,
     1150                .depth-2 .comment-edited {
    11481151                        display: inline-block;
    11491152                        margin: 2px 0;
    11501153                }
     
    11701173                .comment-list li.depth-1,
    11711174                #comment-preview {
    11721175                        border: 1px solid #dfdfdf;
    1173                         border-radius: 2px;
     1176                        border-radius: 2px;     
     1177                        width: 100%;
    11741178                }
    11751179
    11761180                // Feedback
     
    13621366                        padding: 0 5px;
    13631367                }
    13641368
    1365                 .comment-form ul {
     1369                .comment-form ul, .feedback-form ul {
    13661370                        margin-left: 1.5em;
    13671371                }
     1372
     1373                .feedback-form ul li {
     1374                        margin: 0;
     1375                        overflow: visible;
     1376                }
    13681377        }
    13691378
    13701379        &.single-post {
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css

     
    15141514  opacity: 1;
    15151515}
    15161516
    1517 .devhub-wrap .single-wp-parser-function .comment-awaiting-moderation, .devhub-wrap .single-wp-parser-method .comment-awaiting-moderation, .devhub-wrap .single-wp-parser-hook .comment-awaiting-moderation, .devhub-wrap .single-wp-parser-class .comment-awaiting-moderation {
     1517.devhub-wrap .single-wp-parser-function .comment-awaiting-moderation,
     1518.devhub-wrap .single-wp-parser-function .comment-edited, .devhub-wrap .single-wp-parser-method .comment-awaiting-moderation,
     1519.devhub-wrap .single-wp-parser-method .comment-edited, .devhub-wrap .single-wp-parser-hook .comment-awaiting-moderation,
     1520.devhub-wrap .single-wp-parser-hook .comment-edited, .devhub-wrap .single-wp-parser-class .comment-awaiting-moderation,
     1521.devhub-wrap .single-wp-parser-class .comment-edited {
    15181522  background-color: #fff8e5;
    15191523  padding: .2em .5em;
     1524  margin-right: .5em;
    15201525  border-radius: 3px;
    15211526  border: 1px solid #ffb900;
    15221527}
    15231528
    1524 .devhub-wrap .single-wp-parser-function .depth-2 .comment-awaiting-moderation, .devhub-wrap .single-wp-parser-method .depth-2 .comment-awaiting-moderation, .devhub-wrap .single-wp-parser-hook .depth-2 .comment-awaiting-moderation, .devhub-wrap .single-wp-parser-class .depth-2 .comment-awaiting-moderation {
     1529.devhub-wrap .single-wp-parser-function .depth-2 .comment-awaiting-moderation,
     1530.devhub-wrap .single-wp-parser-function .depth-2 .comment-edited, .devhub-wrap .single-wp-parser-method .depth-2 .comment-awaiting-moderation,
     1531.devhub-wrap .single-wp-parser-method .depth-2 .comment-edited, .devhub-wrap .single-wp-parser-hook .depth-2 .comment-awaiting-moderation,
     1532.devhub-wrap .single-wp-parser-hook .depth-2 .comment-edited, .devhub-wrap .single-wp-parser-class .depth-2 .comment-awaiting-moderation,
     1533.devhub-wrap .single-wp-parser-class .depth-2 .comment-edited {
    15251534  display: inline-block;
    15261535  margin: 2px 0;
    15271536}
     
    15611570.devhub-wrap .single-wp-parser-class #comment-preview {
    15621571  border: 1px solid #dfdfdf;
    15631572  border-radius: 2px;
     1573  width: 100%;
    15641574}
    15651575
    15661576.devhub-wrap .single-wp-parser-function .comment-list li.depth-2, .devhub-wrap .single-wp-parser-method .comment-list li.depth-2, .devhub-wrap .single-wp-parser-hook .comment-list li.depth-2, .devhub-wrap .single-wp-parser-class .comment-list li.depth-2 {
     
    17351745  padding: 0 5px;
    17361746}
    17371747
    1738 .devhub-wrap .single-wp-parser-function .comment-form ul, .devhub-wrap .single-wp-parser-method .comment-form ul, .devhub-wrap .single-wp-parser-hook .comment-form ul, .devhub-wrap .single-wp-parser-class .comment-form ul {
     1748.devhub-wrap .single-wp-parser-function .comment-form ul, .devhub-wrap .single-wp-parser-function .feedback-form ul, .devhub-wrap .single-wp-parser-method .comment-form ul, .devhub-wrap .single-wp-parser-method .feedback-form ul, .devhub-wrap .single-wp-parser-hook .comment-form ul, .devhub-wrap .single-wp-parser-hook .feedback-form ul, .devhub-wrap .single-wp-parser-class .comment-form ul, .devhub-wrap .single-wp-parser-class .feedback-form ul {
    17391749  margin-left: 1.5em;
    17401750}
    17411751
     1752.devhub-wrap .single-wp-parser-function .feedback-form ul li, .devhub-wrap .single-wp-parser-method .feedback-form ul li, .devhub-wrap .single-wp-parser-hook .feedback-form ul li, .devhub-wrap .single-wp-parser-class .feedback-form ul li {
     1753  margin: 0;
     1754  overflow: visible;
     1755}
     1756
    17421757.devhub-wrap.single-post .comment-list,
    17431758.devhub-wrap.single-post .comment-list ol {
    17441759  list-style: none;