<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[7754] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer: developer.wordpress.org: Allow users to edit their own submitted notes that are still in moderation.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/7754">7754</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/7754","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>coffee2code</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-10-19 22:56:22 +0000 (Fri, 19 Oct 2018)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>developer.wordpress.org: Allow users to edit their own submitted notes that are still in moderation.

Props keesiemeijer.
Fixes <a href="http://meta.trac.wordpress.org/ticket/3572">#3572</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercommentsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperfunctionsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperinctemplatetagsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperincusercontentphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjsusernotesfeedbackjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-feedback.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjsusernotespreviewjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-preview.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjsusernotesjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperscssmainscss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperstylesheetsmaincss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercommentseditphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperincusercontenteditphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-edit.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercommentseditphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php                             (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php       2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,93 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php namespace DevHub;
+/**
+ * The Template for editing user contributed notes.
+ *
+ * This template is used if the current user can edit a note.
+ * The global post data is set with the pre_get_posts action.
+ *
+ * @package wporg-developer
+ */
+
+get_header(); 
+
+$comment_id    = get_query_var( 'edit_user_note' );
+$comment       = get_comment( $comment_id );
+$post          = get_queried_object();
+$post_id       = get_queried_object_id();
+$can_user_edit = \DevHub\can_user_edit_note( $comment_id );
+
+if ( ! ( $comment && $post && $post_id && $can_user_edit ) ) {
+       // Bail if the current user can't edit this note, or if 
+       // the comment or global post data is not found.
+       include get_404_template();
+       return;
+}
+
+$is_parent   = $comment->comment_parent ?  true : false;
+$parent      = $is_parent ? get_comment( $comment->comment_parent ) : false;
+$post_url    = get_permalink( $post_id );
+$post_title  = single_post_title( '', false );
+$post_types  = get_parsed_post_types( 'labels' );
+$type_single = get_post_type_object( $post->post_type )->labels->singular_name;
+$type_url    = get_post_type_archive_link( $post->post_type );
+$type_label  = $post_types[ $post->post_type ];
+$ref_url     = get_site_section_url();
+$ref_link    = sprintf( '<a href="%s">%s</a>', esc_url( $ref_url ), __( 'Reference', 'wporg' ) );
+$post_link   = sprintf( '<a href="%s">%s</a>', esc_url( $post_url ), $post_title );
+/* translators: %d: comment ID */
+$note_link   = sprintf( '<a href="%s">%s</a>', esc_url( $post_url . '#comment-' . $comment_id ), sprintf( __( 'note %d', $comment_id ), 'wporg' ) );
+$type_link   = sprintf( '<a href="%s">%s</a>', esc_url( $type_url ), $type_label );
+
+$parent_link   = '';
+$parent_author = '';
+if ( $is_parent && isset( $parent->comment_ID ) ) {
+       $parent_author = get_note_author_link( $parent );
+       /* translators: %d: comment ID */
+       $parent_label  = sprintf( __( 'note %d', 'wporg' ), $parent->comment_ID );
+       $parent_link   = sprintf( '<a href="%s">%s</a>', esc_url( $post_url . '#comment-' . $parent->comment_ID ), $parent_label );
+}
+
+add_filter( 'breadcrumb_trail_items', function( $items ) use ( $ref_link, $type_link, $post_link, $note_link ) {
+       $items[] = $ref_link;
+       $items[] = $type_link;
+       $items[] = $post_link;
+       $items[] = $note_link;
+       $items[] = __('Edit', 'wporg');
+       return $items;
+} );
+?>
+
+       <div id="content-area" <?php body_class( 'code-reference' ); ?>>
+
+               <?php breadcrumb_trail( array( 'show_title' => false ) ); ?>
+
+               <main id="main" class="site-main" role="main">
+                       <h1><?php printf( __( 'Edit Note %d', 'wporg' ), $comment_id ); ?></h1>
+
+                       <p>
+                               <?php if ( $is_parent ) : ?>
+                                       <?php
+                                               /* translators: 1: comment title, 2: comment author name, 3: reference type (function, class, method, hook), 4: post title */
+                                               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 );
+                                       ?>
+                               <?php else : ?>
+                                       <?php
+                                               /* translators: 1: reference type (function, class, method, hook), 2: post title */
+                                               printf( __( 'This is a note for the %1$s %2$s.', 'wporg' ), strtolower( $type_single ), $post_link ); ?>
+                               <?php endif; ?>
+
+                               <?php echo ' ' . __( "You can edit this note as long as it's in moderation.", 'wporg' ); ?>
+                       </p>
+                       <?php
+                               if ( $is_parent ) {
+                                       echo \DevHub_User_Submitted_Content::wp_editor_feedback( $comment, 'show', true );
+                               } else {
+                                       $args = \DevHub_User_Submitted_Content::comment_form_args( $comment, 'edit');
+                                       comment_form( $args );
+                               }
+                       ?>
+
+               </main><!-- #main -->
+       </div><!-- #primary -->
+<?php get_footer(); ?>
+
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercommentsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php  2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php    2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,7 +45,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $ordered_comments = wporg_developer_get_ordered_notes();
</span><span class="cx" style="display: block; padding: 0 10px">                                        if ( $ordered_comments ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                $feedback_editor = array_filter(  wp_list_pluck( $ordered_comments, 'show_editor') );
</del><span class="cx" style="display: block; padding: 0 10px">                                                 wporg_developer_list_notes( $ordered_comments, array( 'avatar_size' => 32 ) ); 
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,68 +63,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <?php if ( \DevHub\is_parsed_post_type() && DevHub\can_user_post_note( true, get_the_ID() ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php $add_note_style = empty( $feedback_editor ) ? 'display:none;' : ''; ?>
-               <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>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <?php if ( is_user_logged_in() ) : ?>
+                       <?php 
+                               /* Hide the add user note link by default.
+                                * It will be displayed by Javascript.
+                                * If Javascript is disabled the comment form is displayed and the link stays hidden.
+                                */
+                       ?>
+                       <p id="add-user-note" style="display: none;"><a href="<?php echo user_trailingslashit( get_permalink() ) . '#respond'; ?>"><?php _e( 'Have a note or feedback to contribute?', 'wporg' ); ?></a></p>
+               <?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                <?php 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $args = array(
-                       'logged_in_as'        => '<p class="logged-in-as">'
-                               . sprintf(
-                                       /* translators: 1: user profile link, 2: accessibility text, 3: user name, 4: logout URL */
-                                       __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
-                                       'https://profiles.wordpress.org/' . esc_attr( wp_get_current_user()->user_nicename ),
-                                       /* translators: %s: user name */
-                                       esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
-                                       $user_identity,
-                                       wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) )
-                               )
-                               . '</p><p><ul><li>'
-                               . __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' )
-                               . '</li><li>'
-                               . __( 'Feedback can be to report errors or omissions with the documentation on this page. Such feedback will not be publicly posted.', 'wporg' )
-                               . '</li><li>'
-                               /* translators: 1: php button, 2: js button, 3: inline code button */
-                               . sprintf(
-                                       __( 'You can enter text and code. Use the %1$s, %2$s, or %3$s buttons to wrap code snippets.', 'wporg' ),
-                                       '<span class="text-button">php</span>',
-                                       '<span class="text-button">js</span>',
-                                       '<span class="text-button">' . __( 'inline code', 'wporg' ) . '</span>'
-                               )
-                               . '</li></ul></p>',
-                       'comment_notes_after' => '<p>'
-                               . __( 'Submission Notes:', 'wporg' )
-                               . '<ul><li>'
-                               . __( 'This form is not for support requests, discussions, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' )
-                               . '</li><li>'
-                               . __( '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' )
-                               . '</li><li class="user-notes-are-gpl">'
-                               . sprintf(
-                                       /* translators: 1: GFDL link */
-                                       __( '<strong>NOTE:</strong> All contributions are licensed under %s and are moderated before appearing on the site.', 'wporg' ),
-                                       '<a href="https://gnu.org/licenses/fdl.html">GFDL</a>'
-                               )
-                               . '</li></ul></p>',
-                       'label_submit'        => __( 'Add Note or Feedback', 'wporg' ),
-                       'cancel_reply_link'   => '',
-                       'must_log_in'         => '<p>' . sprintf(
-                               __( 'You must <a href="%s">log in</a> before being able to contribute a note or feedback.', 'wporg' ),
-                               'https://login.wordpress.org/?redirect_to=' . urlencode( get_comments_link() )
-                       ) . '</p>',
-                       'title_reply'         => '', //'Add Example'
-                       'title_reply_to'      => '',
-               );
-
-               if ( class_exists( 'DevHub_Note_Preview' ) ) {
-                       $args['comment_notes_after'] = DevHub_Note_Preview::comment_preview() . $args['comment_notes_after'];
-                       $args['class_form']          = 'comment-form tab-container';
-               }
-
-               if ( class_exists( 'DevHub_User_Submitted_Content' ) ) {
-                       $args['comment_field'] = DevHub_User_Submitted_Content::wp_editor_comments();
-               }
-
-               // Insert comment form if feedback form is not already used.
-               if ( empty( $feedback_editor ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( class_exists( 'DevHub_User_Submitted_Content' ) )  {
+                       $args = \DevHub_User_Submitted_Content::comment_form_args();
</ins><span class="cx" style="display: block; padding: 0 10px">                         comment_form( $args );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                ?>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php 2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php   2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,6 +56,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require __DIR__ . '/inc/user-content-voting.php';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Editing for user-submitted content.
+ */
+require __DIR__ . '/inc/user-content-edit.php';
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * CLI commands custom post type and importer.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> require __DIR__ . '/inc/cli.php';
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperinctemplatetagsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php 2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php   2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -113,7 +113,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Check if the current page is a reply to a note.
</span><span class="cx" style="display: block; padding: 0 10px">                        $reply_id = 0;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( isset( $_GET['replytocom'] ) && $_GET['replytocom'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( isset( $_GET['replytocom'] ) && $_GET['replytocom'] ) {            
+                               /* Javascript uses preventDefault() when clicking links with '?replytocom={comment_ID}'
+                                * We assume Javascript is disabled when visiting a page with this query var.
+                                * There are no consequences if Javascript is enabled.
+                                */
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $reply_id = absint( $_GET['replytocom'] );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,8 +146,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $comments[ $key ]->child_notes = array_reverse( $children[ $comment->comment_ID ] );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( ! $show_editor && ( $reply_id && ( $reply_id === (int) $comment->comment_ID ) ) ) {
-                                       // Show the editor when replying to this parent comment
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( ! $show_editor && ( $reply_id && ( $reply_id === (int) $comment->comment_ID ) ) ) { 
+                                       /* The query var 'replytocom' is used and the value is the same as the current comment ID.
+                                        * We show the editor for the current comment because we assume Javascript is disabled.
+                                        * If Javascript is not disabled the editor is hidden (as normal) by the class 'hide-if-js'.
+                                        */
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $comments[ $key ]->show_editor = true;
</span><span class="cx" style="display: block; padding: 0 10px">                                        $show_editor = true;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -164,10 +171,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param array   $args Comment display arguments.
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                function wporg_developer_list_notes( $comments, $args ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $is_user_content    = class_exists( 'DevHub_User_Submitted_Content' );
</ins><span class="cx" style="display: block; padding: 0 10px">                         $is_user_logged_in  = is_user_logged_in();
</span><span class="cx" style="display: block; padding: 0 10px">                        $can_user_post_note = DevHub\can_user_post_note( true, get_the_ID() );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $user_content       = class_exists( 'DevHub_User_Submitted_Content' );
-                       $display_editor     = $is_user_logged_in && $can_user_post_note && $user_content;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $is_user_verified   = $is_user_logged_in && $can_user_post_note;
+               
+                       $args['updated_note'] = 0;
+                       if ( isset( $_GET['updated-note'] ) && $_GET['updated-note'] ) {
+                               $args['updated_note'] = absint( $_GET['updated-note'] );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        foreach ( $comments as $comment ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -176,9 +188,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                // Display parent comment.
</span><span class="cx" style="display: block; padding: 0 10px">                                wporg_developer_user_note( $comment, $args, 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                // Show or hide feedback notes.
-                               $class = $comment->show_editor ? '' : ' hide-if-js';
-                               echo "<section id='feedback-{$comment_id}' class='feedback{$class}'>\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         /* Use hide-if-js class to hide the feedback section if Javascript is enabled.
+                                * Users can display the section with Javascript.
+                                */
+                               echo "<section id='feedback-{$comment_id}' class='feedback hide-if-js'>\n";
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                // Display child comments.
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( ! empty( $comment->child_notes ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -192,8 +205,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                // Add a feedback form for logged in users.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( $display_editor ) {
-                                       // Show or hide the editor depending if we're replying to a note.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $is_user_content && $is_user_verified ) {
+                                       /* Show the feedback editor if we're replying to a note and Javascript is disabled.
+                                        * If Javascript is enabled the editor is hidden (as normal) by the 'hide-if-js' class.
+                                        */
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $display = $comment->show_editor ? 'show' : 'hide';
</span><span class="cx" style="display: block; padding: 0 10px">                                        echo DevHub_User_Submitted_Content::wp_editor_feedback( $comment, $display );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,10 +217,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                // Feedback links to log in, add feedback or show feedback.
</span><span class="cx" style="display: block; padding: 0 10px">                                echo "<footer class='feedback-links' >\n";
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( $can_user_post_note ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        echo "EEE";
</del><span class="cx" style="display: block; padding: 0 10px">                                         $feedback_link = trailingslashit( get_permalink() ) . "?replytocom={$comment_id}#feedback-editor-{$comment_id}";
</span><span class="cx" style="display: block; padding: 0 10px">                                        $display       = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $aria          = '';
</del><span class="cx" style="display: block; padding: 0 10px">                                         if ( ! $is_user_logged_in ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $class         = 'login';
</span><span class="cx" style="display: block; padding: 0 10px">                                                $feedback_text = __( 'Log in to add feedback', 'wporg' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -213,12 +226,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $class         ='add';
</span><span class="cx" style="display: block; padding: 0 10px">                                                $feedback_text = __( 'Add feedback to this note', 'wporg' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                $aria          = '';//" aria-expanded='false' aria_controls='feedback-editor-{$comment_id}' aria-label='" . esc_attr( $feedback_text ) . "'";
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                // Hide 'add feedback' link if editor is displayed.
-                                               $display = $display_editor && $comment->show_editor ? ' style="display:none"' : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         /* Hide the feedback link if the current user is logged in and the
+                                                * feedback editor is displayed (because Javascript is disabled).
+                                                * If Javascript is enabled the editor is hidden and the feedback link is displayed (as normal).
+                                                */
+                                               $display = $is_user_verified && $comment->show_editor ? ' style="display:none"' : '';
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        echo '<a class="feedback-' . $class . '" href="' . esc_url( $feedback_link ) . '"' . $display . $aria .' rel="nofollow">' . $feedback_text . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 echo '<a role="button" class="feedback-' . $class . '" href="' . esc_url( $feedback_link ) . '"' . $display . ' rel="nofollow">' . $feedback_text . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                // close parent list item
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -240,13 +255,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $GLOBALS['comment']       = $comment;
</span><span class="cx" style="display: block; padding: 0 10px">                        $GLOBALS['comment_depth'] = $depth;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        static $note_number = 0;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $approved       = ( 0 < (int) $comment->comment_approved ) ? true : false;
</span><span class="cx" style="display: block; padding: 0 10px">                        $is_parent      = ( 0 === (int) $comment->comment_parent ) ? true : false;
</span><span class="cx" style="display: block; padding: 0 10px">                        $is_voting      = class_exists( 'DevHub_User_Contributed_Notes_Voting' );
</span><span class="cx" style="display: block; padding: 0 10px">                        $count          = $is_voting ? (int)  DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' ) : 0;
</span><span class="cx" style="display: block; padding: 0 10px">                        $curr_user_note = $is_voting ? (bool) DevHub_User_Contributed_Notes_Voting::is_current_user_note( $comment->comment_ID ) : false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $edited_note_id = isset( $args['updated_note'] ) ? $args['updated_note'] : 0;
+                       $is_edited_note = ( $edited_note_id === (int) $comment->comment_ID );
+                       $note_author    = \DevHub\get_note_author_link( $comment );
+                       $can_edit_note  = \DevHub\can_user_edit_note( $comment->comment_ID );
+                       $has_edit_cap   = current_user_can( 'edit_comment', $comment->comment_ID );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Classes
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // CSS Classes
</ins><span class="cx" style="display: block; padding: 0 10px">                         $comment_class = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( -1 > $count ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -261,21 +283,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $comment_class[] = 'user-note-moderated';
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // This would all be moot if core passed the $comment context for 'get_comment_author_link' filter.
-                       if ( $comment->user_id ) {
-                               $commenter = get_user_by( 'id', $comment->user_id );
-                               $url = 'https://profiles.wordpress.org/' . sanitize_key( $commenter->user_nicename ) . '/';
-                               $author = get_the_author_meta( 'display_name', $comment->user_id );
-                       } else {
-                               $url = $comment->comment_author_url;
-                               $author = $comment->comment_author;
-                       }
-
-                       $comment_author_link = $author;
-                       if ( $url ) {
-                               $comment_author_link = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
-                       }
-
</del><span class="cx" style="display: block; padding: 0 10px">                         $date = sprintf( _x( '%1$s ago', '%1$s = human-readable time difference', 'wporg' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                human_time_diff( get_comment_time( 'U' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                current_time( 'timestamp' ) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -285,7 +292,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php if ( $is_parent ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <a href="#comment-content-<?php echo $comment->comment_ID; ?>" class="screen-reader-text"><?php _e( 'Skip to note content', 'wporg' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <a href="#comment-content-<?php echo $comment->comment_ID; ?>" class="screen-reader-text"><?php printf( __( 'Skip to note %d content', 'wporg' ), ++ $note_number ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <header class="comment-meta">
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -300,17 +307,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                        echo get_avatar( $comment, $args['avatar_size'] );
</span><span class="cx" style="display: block; padding: 0 10px">                                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $note_author ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                                </span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                &mdash;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <a class="comment-date" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         <time datetime="<?php comment_time( 'c' ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <?php echo $date; ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        </time>
</span><span class="cx" style="display: block; padding: 0 10px">                                                </a>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <?php edit_comment_link( __( 'Edit', 'wporg' ), '<span class="edit-link">&mdash; ', '</span>' ); ?>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                <?php if ( ! $has_edit_cap && $can_edit_note ) : ?>
+                                                       &mdash; <span class="comment-author-edit-link">
+                                                               <!-- Front end edit comment link -->
+                                                               <a class="comment-edit-link" href="<?php echo site_url( "/reference/comment/edit/{$comment->comment_ID}" ); ?>"><?php _e( 'Edit', 'wporg' ); ?></a>
+                                                       </span>
+                                               <?php endif; ?>
+                                               <?php if ( $can_edit_note && $is_edited_note ) : ?>
+                                                       &mdash; <span class="comment-edited">
+                                                       <?php _e( 'edited', 'wporg' ); ?>
+                                                       </span>
+                                               <?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <?php if ( ! $approved ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        &mdash; <span class="comment-awaiting-moderation"><?php _e( 'awaiting moderation', 'wporg' ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <?php endif; ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -325,15 +344,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        comment_text();
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $text = get_comment_text()  . ' &mdash; ';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $text .= sprintf( __( 'By %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) ) . ' &mdash; ';
-                                       $text .= ' <a href="'. esc_url( get_comment_link( $comment->comment_ID ) ) . '">';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $text .= sprintf( __( 'By %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $note_author ) ) . ' &mdash; ';
+                                       $text .= ' <a class="comment-date" href="'. esc_url( get_comment_link( $comment->comment_ID ) ) . '">';
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $text .= '<time datetime="' . get_comment_time( 'c' ) . '">' . $date . '</time></a>';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( $has_edit_cap ) {
+                                               // WP admin edit comment link.
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $text .= ' &mdash; <a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) .'">';
</span><span class="cx" style="display: block; padding: 0 10px">                                                $text .= __( 'Edit', 'wporg' ) . '</a>';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        } elseif ( $can_edit_note ) {
+                                               // Front end edit comment link.
+                                               $text .= ' &mdash; <a class="comment-edit-link" href="' . site_url( "/reference/comment/edit/{$comment->comment_ID}" ) . '">';
+                                               $text .= __( 'Edit', 'wporg' ) . '</a>';
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        if ( $can_edit_note && $is_edited_note ) {
+                                               $text .= ' &mdash; <span class="comment-edited">' . __( 'edited', 'wporg' ) . '</span>';
+                                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         if ( ! $approved ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $text .= ' &mdash; <span class="comment-awaiting-moderation">' . __( 'awaiting moderation', 'wporg' ) . '</span>';
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1407,6 +1435,76 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Indicates if the current user can edit a user contibuted note.
+        *
+        * A user can only edit their own notes if it's in moderation and
+        * if it's a note for a parsed post type.
+        *      
+        * Users with the 'edit_comment' capability can edit
+        * all notes from a parsed post type (regardless if it's in moderation).
+        *
+        * @param integer $note_id Note ID.
+        * @return bool True if the current user can edit notes.
+        */
+       function can_user_edit_note( $note_id = 0 ) {
+               $user = get_current_user_id();
+               $note = get_comment( $note_id );
+               if ( ! $user || ! $note ) {
+                       return false;
+               }
+
+               $post_id        = isset( $note->comment_post_ID ) ? (int) $note->comment_post_ID : 0;
+               $is_note_author = isset( $note->user_id ) && ( (int) $note->user_id === $user );
+               $is_approved    = isset( $note->comment_approved ) && ( 0 < (int) $note->comment_approved );
+               $can_edit_notes = isset( $note->comment_ID ) && current_user_can( 'edit_comment', $note->comment_ID );
+               $is_parsed_type = is_parsed_post_type( get_post_type( $post_id ) );
+
+               if ( $is_parsed_type && ( $can_edit_notes || ( $is_note_author && ! $is_approved ) ) ) {
+                       return true;
+               }
+
+               return false;
+       }
+
+       /**
+        * Get the note author link to the profiles.wordpress.org author's URL.
+        *
+        * @param WP_Comment|int $comment Comment object or comment ID.
+        * @return string The HTML link to the profiles.wordpress.org author's URL.
+        */
+       function get_note_author_link( $comment ) {
+               return get_note_author( $comment, true );
+       }
+
+       /**
+        * Get the note author nicename.
+        *
+        * @param WP_Comment|int $comment Comment object or comment ID.
+        * @param bool           $link. Whether to return a link to the author's profiles. Default false.
+        * @return string The comment author name or HTML link.
+        */
+       function get_note_author( $comment, $link = false ) {
+               $comment   = get_comment( $comment );
+               $user_id   = isset( $comment->user_id ) ? $comment->user_id : 0;
+               $commenter = get_user_by( 'id', $comment->user_id );
+               $author    = '';
+
+               if ( $user_id && isset( $commenter->user_nicename ) ) {
+                       $url    = 'https://profiles.wordpress.org/' . sanitize_key( $commenter->user_nicename ) . '/';
+                       $author = get_the_author_meta( 'display_name', $comment->user_id );
+               } else {
+                       $url    = isset( $comment->comment_author_url ) ? $comment->comment_author_url : '';
+                       $author = isset( $comment->comment_author ) ?  $comment->comment_author : '';
+               }
+
+               if ( $link && ( $url && $author ) ) {
+                       $author = sprintf( '<a href="%s" rel="external nofollow" class="url">%s</a>', esc_url( $url ), $author );
+               }
+
+               return $author;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Gets the summary.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * The summary (aka short description) is stored in the 'post_excerpt' field.
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperincusercontenteditphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-edit.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-edit.php                             (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-edit.php       2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,194 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Code Reference edit user submitted content (comments, notes, etc).
+ *
+ * Allows users to edit top level and child comments from parsed post types.
+ *
+ * @package wporg-developer
+ */
+
+/**
+ * Class to handle editing user submitted content.
+ */
+class DevHub_User_Content_Edit {
+
+       /**
+        * Initializer
+        */
+       public static function init() {
+               // Priority 20 is after this theme and the WP Parser register post types.
+               add_action( 'init', array( __CLASS__, 'do_init' ), 20 );
+       }
+
+       /**
+        * Handles adding hooks to enable editing comments.
+        * Adds rewrite rules for editing comments in the front end.
+        */
+       public static function do_init() {
+               // Add the edit user note rewrite rule
+               add_rewrite_rule( 'reference/comment/edit/([0-9]{1,})/?$', 'index.php?edit_user_note=$matches[1]', 'top' );
+
+               // Update comment for edit comment request
+               self::update_comment();
+
+               // Add edit_user_note query var for editing.
+               add_filter( 'query_vars',                      array( __CLASS__, 'comment_query_var' ) );
+
+               // Redirect to home page if the edit request is invalid.
+               add_action( 'template_redirect',               array( __CLASS__, 'redirect_invalid_edit_request' ) );
+
+               // Include the comment edit template.
+               add_filter( 'template_include',                array( __CLASS__, 'template_include' ) );
+
+               // Set the post_type and post id for use in the comment edit template.
+               add_action( 'pre_get_posts',                   array( __CLASS__, 'pre_get_posts' ) );
+       }
+
+       /**
+        * Add the edit_user_note query var to the public query vars.
+        *
+        * @param array $query_vars Array with public query vars.
+        * @return array Public query vars.
+        */
+       public static function comment_query_var( $query_vars ) {
+               $query_vars[] = 'edit_user_note';
+               return $query_vars;
+       }
+
+       /**
+        * Update a comment after editing.
+        */
+       public static function update_comment() {
+
+               if ( is_admin() || ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) ) {
+                       return;
+               }
+
+               $comment_data = wp_unslash( $_POST );
+
+               $defaults = array(
+                       'update_user_note',
+                       '_wpnonce',
+                       'comment_ID',
+                       'comment',
+                       'comment_parent',
+                       'comment_post_ID'
+               );
+
+               foreach ( $defaults as $value ) {
+                       if ( ! isset( $comment_data[ $value ] ) ) {
+                               // Return if any of the $_POST keys are missing.
+                               return;
+                       }
+               }
+
+               $comment = trim( (string) $comment_data['comment'] );
+               if ( ! $comment ) {
+                       // Bail and provide a way back to the edit form if a comment is empty.
+                       $msg  = __( '<strong>ERROR</strong>: please type a comment.', 'wporg' );
+                       $args = array( 'response' => 200, 'back_link' => true );
+                       wp_die( '<p>' . $msg . '</p>', __( 'Comment Submission Failure', 'wporg' ), $args );
+               }
+
+               $updated       = 0;
+               $post_id       = absint( $comment_data['comment_post_ID'] );
+               $comment_id    = absint( $comment_data['comment_ID'] );
+               $can_user_edit = DevHub\can_user_edit_note( $comment_id );
+               $action        = 'update_user_note_' . $comment_id;
+               $nonce         = wp_verify_nonce( $comment_data['_wpnonce'], $action );
+
+               if ( $nonce && $can_user_edit ) {
+                       $comment_data['comment_content'] = $comment;
+                       $updated = wp_update_comment( $comment_data );
+               }
+
+               $location = get_permalink( $post_id );
+               if ( $location ) {
+                       $query = $updated ? '?updated-note=' . $comment_id : '';
+                       $query .= '#comment-' . $comment_id;
+                       wp_safe_redirect( $location . $query );
+                       exit;
+               }
+       }
+
+       /**
+        * Redirects to the home page if the edit request is invalid for the current user.
+        *
+        * Redirects if the comment doesn't exist.
+        * Redirects if the comment is not for a parsed post type.
+        * Redirects if the current user is not the comment author.
+        * Redirects if a comment is already approved.
+        *
+        * Doesn't redirect for users with the edit_comment capability.
+        */
+       public static function redirect_invalid_edit_request() {
+               $comment_id = absint( get_query_var( 'edit_user_note' ) );
+               if ( ! $comment_id ) {
+                       // Not a query for editing a note.
+                       return;
+               }
+
+               if ( ! DevHub\can_user_edit_note( $comment_id ) ) {
+                       wp_redirect( home_url( '/reference' ) );
+                       exit();
+               }
+       }
+
+       /**
+        * Use the 'comments-edit.php' template for editing comments.
+        *
+        * The current user has already been verified in the template_redirect action.
+        *
+        * @param string $template Template to include.
+        * @return string Template to include.
+        */
+       public static function template_include( $template ) {
+               $comment_id = absint( get_query_var( 'edit_user_note' ) );
+               if ( ! $comment_id ) {
+                       // Not a query for editing a note.
+                       return $template;
+               }
+
+               $comment_template = get_query_template( "comments-edit" );
+               if ( $comment_template ) {
+                       $template = $comment_template;
+               }
+
+               return $template;
+       }
+
+       /**
+        * Sets the post and post type for an edit request.
+        *
+        * Trows a 404 if the current user can't edit the requested note.
+        *
+        * @param WP_Query $query The WP_Query instance (passed by reference)
+        */
+       public static function pre_get_posts( $query ) {
+               $comment_id = absint( get_query_var( 'edit_user_note' ) );
+
+               if ( is_admin() || ! ( $query->is_main_query() && $comment_id ) ) {
+                       // Not a query for editing a note.
+                       return;
+               }
+
+               if ( DevHub\can_user_edit_note( $comment_id ) ) {
+                       $comment = get_comment( $comment_id );
+                       if ( isset( $comment->comment_post_ID ) ) {
+                               $query->is_singular = true;
+                               $query->is_single = true;
+                               $query->set( 'post_type', get_post_type( $comment->comment_post_ID ) );
+                               $query->set( 'p', $comment->comment_post_ID );
+
+                               return;
+                       }
+               }
+
+               // Set 404 if a user can't edit a note.
+               $query->set_404();
+       }
+
+} // DevHub_User_Content_Edit
+
+DevHub_User_Content_Edit::init();
+
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-edit.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperincusercontentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php  2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php    2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,7 +50,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'comment_text',                 'capital_P_dangit',   31 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Enable shortcodes for comments
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                add_filter( 'comment_text',                    'do_shortcode');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         add_filter( 'comment_text',                    'do_shortcode' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Customize allowed tags
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_kses_allowed_html',            array( __CLASS__, 'wp_kses_allowed_html' ), 10, 2 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -67,6 +67,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Allowed HTML for an edited child comment (There is no decent hook to filter child comments only)
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'edit_comment',                    array( __CLASS__, 'comment_edit_allowed_html' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Adds hidden fields to a comment form for editing
+               add_filter( 'comment_form_submit_field',       array( __CLASS__, 'add_hidden_fields' ), 10, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,9 +150,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $allowed_protocols = array( 'http', 'https' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $comment_content   = wp_kses( $comment_content, $allowed_html, $allowed_protocols );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $comment_content = wp_kses( $comment_content, $allowed_html, $allowed_protocols );
-               $commentdata['comment_content'] = preg_replace( '/\r?\n|\r/', '', $comment_content );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Replace newlines with a space.
+               $commentdata['comment_content'] = preg_replace( '/\r?\n|\r/', ' ', $comment_content );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $commentdata;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -167,8 +170,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array( 'jquery', 'quicktags' ), '20180323', true );
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_enqueue_script( 'wporg-developer-user-notes-feedback', get_template_directory_uri() . '/js/user-notes-feedback.js', array( 'jquery', 'quicktags' ), '20180323', true );
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_localize_script( 'wporg-developer-user-notes-feedback', 'wporg_note_feedback', array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'show' => __( 'Show Feedback', 'wporg' ),
-                               'hide' => __( 'Hide Feedback', 'wporg' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'show'             => __( 'Show Feedback', 'wporg' ),
+                               'hide'             => __( 'Hide Feedback', 'wporg' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ) );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -176,7 +179,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Sets the default language for SyntaxHighlighter shortcode.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param  array $atts Shortcode attributes.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param array $atts Shortcode attributes.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return array
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public static function syntaxhighlighter_shortcodeatts( $atts ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -187,7 +190,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Subverts capital_P_dangit for SyntaxHighlighter shortcode.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param  string $code
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param string $code
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public static function syntaxhighlighter_precode( $code ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -195,40 +198,131 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Add hidden fields to the comment form if the context is 'edit'
+        *
+        * @param string $submit_field HTML string with the submit button fields.
+        * @param array  $args         Arguments for the comment form.
+        * @return HTML string with the submit button fields.
+        */
+       public static function add_hidden_fields( $submit_field, $args ) {
+               $context = isset( $args['context'] ) ? $args['context'] : '';
+               $comment = isset( $args['comment_edit'] ) ? $args['comment_edit'] : false;
+               if ( ! ( $comment && ( 'edit' === $context ) ) ) {
+                       return $submit_field;
+               }
+
+               $comment_id = isset( $comment->comment_ID ) ? $comment->comment_ID : 0;
+
+               return $submit_field . self::get_edit_fields( $comment_id, $instance = 0 );
+       }
+
+       /**
+        * Get the comment form arguments by context.
+        *
+        * @param WP_Comment|false $comment Comment object or false. Default false.
+        * @param string           $context Context of arguments. Accepts 'edit' or empty string.
+        * @return array Array with comment form arguments.
+        */
+       public static function comment_form_args( $comment = false, $context = '' ) {
+               $label = _x( 'Add Note or Feedback', 'noun', 'wporg' );
+               if ( 'edit' === $context ) {
+                       $label = _x( 'Edit Note', 'noun', 'wporg' );
+               }
+
+               $user_identity = wp_get_current_user();
+
+               $args = array(
+                       'logged_in_as'        => '<p class="logged-in-as">'
+                       . sprintf(
+                               /* translators: 1: user profile link, 2: accessibility text, 3: user name, 4: logout URL */
+                               __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
+                               'https://profiles.wordpress.org/' . esc_attr( $user_identity->user_nicename ),
+                               /* translators: %s: user name */
+                               esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity->display_name ) ),
+                               $user_identity->display_name,
+                               wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) )
+                       )
+                       . '</p><p><ul><li>'
+                       . __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' )
+                       . '</li><li>'
+                       . __( 'Feedback can be to report errors or omissions with the documentation on this page. Such feedback will not be publicly posted.', 'wporg' )
+                       . '</li><li>'
+                       /* translators: 1: php button, 2: js button, 3: inline code button */
+                       . sprintf(
+                               __( 'You can enter text and code. Use the %1$s, %2$s, or %3$s buttons to wrap code snippets.', 'wporg' ),
+                               '<span class="text-button">php</span>',
+                               '<span class="text-button">js</span>',
+                               '<span class="text-button">' . __( 'inline code', 'wporg' ) . '</span>'
+                       )
+                       . '</li></ul></p>',
+                       'comment_notes_after' => '<p>' . __( 'Submission Notes:', 'wporg' ) . '</p>' . self::get_editor_rules(),
+                       'label_submit'        => $label,
+                       'cancel_reply_link'   => '',
+                       'must_log_in'         => '<p>' . sprintf(
+                               __( 'You must <a href="%s">log in</a> before being able to contribute a note or feedback.', 'wporg' ),
+                               'https://login.wordpress.org/?redirect_to=' . urlencode( get_comments_link() )
+                       ) . '</p>',
+                       'title_reply'         => '', //'Add Example'
+                       'title_reply_to'      => '',
+               );
+
+               if ( class_exists( 'DevHub_Note_Preview' ) ) {
+                       $args['comment_notes_after'] = DevHub_Note_Preview::comment_preview() . $args['comment_notes_after'];
+                       $args['class_form']          = "comment-form tab-container";
+               }
+
+               $args['comment_field'] = self::wp_editor_comments( $label, $comment );
+
+               // Args for adding hidden links after the comment form submit field. 
+               $args['context']      = $context;
+               $args['comment_edit'] = $comment;
+
+               if ( $comment && ( 'edit' === $context ) ) {
+                       $comment_id = isset( $comment->comment_ID ) ? $comment->comment_ID : 0;
+                       $post_id    = isset( $comment->comment_post_ID ) ? $comment->comment_post_ID : 0;
+
+                       $args['action'] = get_permalink( $post_id ) . '#comment-' . $comment_id;
+               }
+
+               return $args;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Capture an {@see wp_editor()} instance as the 'User Contributed Notes' comment form.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Uses output buffering to capture the editor instance for use with the {@see comments_form()}.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @param string           $label   Label used for the editor.
+        * @param WP_Comment|false $comment Comment object or false. Default false.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string HTML output for the wp_editor-ized comment form.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public static function wp_editor_comments() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wp_editor_comments( $label, $comment = false ) {
+               $content = isset( $comment->comment_content ) ? trim( $comment->comment_content ) : '';
+
+               // wp_kses() converts htmlspecialchars in source code.
+               $content = $content ? htmlspecialchars_decode( $content ) : '';
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 ob_start();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo '<h3><label for="comment">' . _x( 'Add Note or Feedback', 'noun', 'wporg' ) . '</label></h3>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo '<h3><label for="comment">' . $label . '</label></h3>';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( class_exists( 'DevHub_Note_Preview' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        echo '<ul class="tablist" style="display:none;">';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 echo "<ul class='tablist' style='display: none;'>";
</ins><span class="cx" style="display: block; padding: 0 10px">                         echo '<li><a href="#comment-form-comment">' . __( 'Write', 'wporg' ) . '</a></li>';
</span><span class="cx" style="display: block; padding: 0 10px">                        echo '<li><a href="#comment-preview">' . __( 'Preview', 'wporg' ) . '</a></li></ul>';
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $style = '<style type="text/css">';
-               ob_start();
-               include get_stylesheet_directory() . '/stylesheets/editor-style.css';
-               $style .= ob_get_clean();
-               $style .=' </style>';
-
</del><span class="cx" style="display: block; padding: 0 10px">                 echo '<div class="comment-form-comment tab-section" id="comment-form-comment">';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                wp_editor( '', 'comment', array(
-                       'media_buttons' => false,
-                       'editor_css'    => $style,
-                       'textarea_name' => 'comment',
-                       'textarea_rows' => 8,
-                       'quicktags'     => array(
-                               'buttons' => 'strong,em,ul,ol,li'
-                       ),
-                       'teeny'         => true,
-                       'tinymce'       => false,
-               ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         wp_editor( $content, 'comment', array(
+                               'media_buttons' => false,
+                               'editor_css'    => self::get_editor_style(),
+                               'textarea_name' => 'comment',
+                               'textarea_rows' => 8,
+                               'quicktags'     => array(
+                                       'buttons' => 'strong,em,ul,ol,li'
+                               ),
+                               'teeny'         => true,
+                               'tinymce'       => false,
+                       ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 echo '</div>';
</span><span class="cx" style="display: block; padding: 0 10px">                return ob_get_clean();
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -238,9 +332,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Uses output buffering to capture the editor instance.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @param WP_Comment|false $comment Comment object or false. Default false.
+        * @param string           $display Display the editor. Default 'show'.
+        * @param bool             $edit    True if the editor used for editing a note. Default false.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return string HTML output for the wp_editor-ized feedback form.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public static function wp_editor_feedback( $comment, $display = 'show', $content = '' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wp_editor_feedback( $comment, $display = 'show', $edit = false ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! ( isset( $comment->comment_ID ) && absint( $comment->comment_ID ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -251,17 +348,37 @@
</span><span class="cx" style="display: block; padding: 0 10px">                static $instance = 0;
</span><span class="cx" style="display: block; padding: 0 10px">                $instance++;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $display     = ( 'hide' === $display ) ? ' style="display: none;"' : '';
-               $title       = __( 'Add feedback to this note', 'wporg' );
-               $form_type   = '';
-               $button_text = __( 'Add Feedback', 'wporg' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $display       = ( 'hide' === $display ) ? ' style="display: none;"' : '';
+               $parent        = $comment_id;
+               $action        = site_url( '/wp-comments-post.php' );
+               $title         = __( 'Add feedback to this note', 'wporg' );
+               $button_text   = __( 'Add Feedback', 'wporg' );
+               $post_id       = isset( $comment->comment_post_ID ) ? $comment->comment_post_ID : get_the_ID();
+               $content       = '';
+               $form_type     = '';
+               $note_link     = '';
+               $class         = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $content ) {
-                       $title       = __( 'Edit feedback', 'wporg' );
-                       $form_type   = '-edit';
-                       $button_text = __( 'Edit Feedback', 'wporg' );
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $edit ) {
+                       $content       = isset( $comment->comment_content ) ? $comment->comment_content : '';
+                       $title         = __( 'Edit feedback', 'wporg' );
+                       $form_type     = '-edit';
+                       $button_text   = __( 'Edit Note', 'wporg' );
+                       $post_url      = get_permalink( $post_id );
+                       $action        = $post_url ? $post_url . '#comment-' . $comment_id : '';
+                       $parent        = isset( $comment->comment_parent ) ? $comment->comment_parent : 0;
+                       $parent_author = \DevHub\get_note_author( $parent );
+                       $class         = ' edit-feedback-editor';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        if ( $parent && $post_url && $parent_author ) {
+                               $post_url  = $post_url . '#comment-' . $parent;
+                               $parent_note = sprintf( __( 'note %d', 'wporg' ), $parent );
+
+                               /* translators: 1: note, 2: note author name */
+                               $note_link = sprintf( __( '%1$s by %2$s', 'wporg' ), "<a href='{$post_url}'>{$parent_note}</a>", $parent_author );
+                       }
+               } 
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $allowed_tags = '';
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( array( '<strong>', '<em>', '<code>', '<a>' ) as $tag ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $allowed_tags .= '<code>' . htmlentities( $tag ) . '</code>, ';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -268,30 +385,107 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                ob_start();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo "<div id='feedback-editor-{$comment_id}' class='feedback-editor'{$display}>\n";
-               echo "<p class='feedback-editor-title'>{$title}</p>\n";
-               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";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo "<div id='feedback-editor-{$comment_id}' class='feedback-editor{$class}'{$display}>\n";
+               if ( ! $edit ) {
+                       echo "<p class='feedback-editor-title'>{$title}</p>\n";
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                wp_editor( '', 'feedback-' . $instance, array(
-                       'media_buttons' => false,
-                       'textarea_name' => 'comment',
-                       'textarea_rows' => 3,
-                       'quicktags'     => array(
-                               'buttons' => 'strong,em'
-                       ),
-                       'teeny'         => true,
-                       'tinymce'       => false,
-               ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo "<form id='feedback-form-{$instance}{$form_type}' class='feedback-form' method='post' action='{$action}' name='feedback-form-{$instance}'>\n";
+               echo self::get_editor_rules( 'feedback', $note_link );
+               wp_editor( $content, 'feedback-' . $instance, array(
+                               'media_buttons' => false,
+                               'textarea_name' => 'comment',
+                               'textarea_rows' => 3,
+                               'quicktags'     => array(
+                                       'buttons' => 'strong,em'
+                               ),
+                               'editor_css'    => self::get_editor_style(),
+                               'teeny'         => true,
+                               'tinymce'       => false,
+                       ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                echo '<p><strong>' . __( 'Note', 'wporg' ) . '</strong>: ' . __( 'No newlines allowed', 'wporg' ) . '. ';
</span><span class="cx" style="display: block; padding: 0 10px">                printf( __( 'Allowed tags: %s', 'wporg' ), trim( $allowed_tags, ', ' ) ) . "</p>\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo "<p><input id='submit-{$instance}' class='submit' type='submit' value='Add Feedback' name='submit-{$instance}'>\n";
-               echo "<input type='hidden' name='comment_post_ID' value='" . get_the_ID() . "' id='comment_post_ID-{$instance}' />\n";
-               echo "<input type='hidden' name='comment_parent' id='comment_parent-{$instance}' value='{$comment_id}' />\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo "<p><input id='submit-{$instance}' class='submit' type='submit' value='{$button_text}' name='submit-{$instance}'>\n";
+               echo "<input type='hidden' name='comment_post_ID' value='{$post_id}' id='comment_post_ID-{$instance}' />\n";
+               echo "<input type='hidden' name='comment_parent' id='comment_parent-{$instance}' value='{$parent}' />\n";
+
+               if ( $edit ) {
+                       echo self::get_edit_fields( $comment_id, $instance );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 echo "</p>\n</form>\n</div><!-- #feedback-editor-{$comment_id} -->\n";
</span><span class="cx" style="display: block; padding: 0 10px">                return ob_get_clean();
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Get the rules list for the comment form.
+        *
+        * @param string $context   Accepts 'feedback' or empty sring.
+        * @param string $note_link Link to parent note.
+        * @return string Editor rules.
+        */
+       public static function get_editor_rules( $context = '', $note_link = '' ) {
+               $license_rule = sprintf(
+                       /* translators: 1: GFDL link */
+                       __( '<strong>NOTE:</strong> All contributions are licensed under %s and are moderated before appearing on the site.', 'wporg' ),
+                       '<a href="https://gnu.org/licenses/fdl.html">GFDL</a>'
+               );
+
+               if ( 'feedback' === $context ) {
+                       $feedback_rule = __( 'Use this form to report errors or to add additional information to this note.', 'wporg' );
+                       if ( $note_link ) {
+                               $feedback_rule = sprintf( __( 'Use this form to report errors or to add additional information to %s.', 'wporg' ), $note_link );
+                       }
+
+                       return '<ul><li>'
+                               . __( 'Feedback is part of the documentation.', 'wporg' ) . ' '
+                               . $feedback_rule
+                               . '</li><li>'
+                               . __( 'This form is not for support requests, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' )
+                               . '</li><li class="user-notes-are-gpl">'
+                               . $license_rule
+                               . '</li></ul>';
+               }
+
+               return '<ul><li>'
+                       . __( 'This form is not for support requests, discussions, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' )
+                       . '</li><li>'
+                       . __( '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' )
+                       . '</li><li class="user-notes-are-gpl">'
+                       . $license_rule
+                       . '</li></ul>';
+       }
+
+       /**
+        * Get the editor styles.
+        *
+        * @return string Editor styles.
+        */
+       public static function get_editor_style() {
+               $style = '<style type="text/css">';
+               ob_start();
+               include get_stylesheet_directory() . '/stylesheets/editor-style.css';
+               $style .= ob_get_clean();
+               $style .= ' </style>';
+               return $style;
+       }
+
+       /**
+        * Get the hidden input fields HTML used for editing a note.
+        *
+        * @param int     $comment_id Comment ID.
+        * @param integer $instance   Comment form instance number used in HTML id's.
+        * @return string Hidden input fields HTML.
+        */
+       public static function get_edit_fields( $comment_id, $instance = 0 ) {
+               $fields = "<input type='hidden' name='comment_ID' id='comment_ID-{$instance}' value='{$comment_id}' />\n";
+               $fields .= "<input type='hidden' name='update_user_note' id='update_user_note-{$instance}' value='1' />\n";
+               $fields .= wp_nonce_field( 'update_user_note_' . $comment_id, '_wpnonce', true, false );
+
+               return $fields;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> } // DevHub_User_Submitted_Content
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> DevHub_User_Submitted_Content::init();
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjsusernotesfeedbackjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-feedback.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-feedback.js     2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-feedback.js       2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,23 +4,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        var wpAdminBar     = 0;
</ins><span class="cx" style="display: block; padding: 0 10px">         var options        = wporg_note_feedback;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        var wpAdminBar     = $('#page.admin-bar').length ? 32 : 0;
-       var feedbackToggle = $( '<a class="feedback-toggle" href="#">' + options.show + '</a>' );
-       var hash           = window.location.hash;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var feedbackToggle = $( '<a role="button" class="feedback-toggle" href="#">' + options.show + '</a>' );
+       var commentID      = window.location.hash;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Check if the fragment identifier is a comment ID (e.g. #comment-63)
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( !hash.match( /#comment\-[0-9]+$/ ) ) {
-               hash = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( !commentID.match( /#comment\-[0-9]+$/ ) ) {
+               commentID = '';
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px">        
</span><span class="cx" style="display: block; padding: 0 10px">        $( '.feedback-editor' ).each( function() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Hide feedback editors with hide-if-js class
+               $( this ).not('.edit-feedback-editor').addClass( 'hide-if-js' );
+               $( this ).removeAttr("style");
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Hide hidden editor with 'hide-if-js' class.
-               if( 'none' === $(this).css('display') ) {
-                       $( this ).show().addClass( 'hide-if-js' );
-               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                 // Add quicktag 'inline code' button to editor. 
</span><span class="cx" style="display: block; padding: 0 10px">                var id = $( this ).find( 'textarea' ).attr( 'id' );
</span><span class="cx" style="display: block; padding: 0 10px">                if ( id.length ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,9 +35,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        var feedback = $( this ).find( '.feedback' );
</span><span class="cx" style="display: block; padding: 0 10px">                        var toggle = feedbackToggle.clone();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        var feedback_id = getCommentID( $(this) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         toggle.attr( {
</span><span class="cx" style="display: block; padding: 0 10px">                                'aria-expanded': 'false',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'aria-controls': 'feedback-' + getCommentID( $(this) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'aria-controls': 'feedback-' + feedback_id
</ins><span class="cx" style="display: block; padding: 0 10px">                         } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Set text to 'Hide Feedback' if feedback is displayed
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -47,15 +46,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                toggle.text( options.hide );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        feedbackLinks.find( '.feedback-add' ).show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Display hidden add feedback link and add aria
+                       feedbackLinks.find( '.feedback-add' ).removeAttr("style").attr( {
+                               'aria-expanded': 'false',
+                               'aria-controls': 'feedback-editor-' + feedback_id
+                       } );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         feedbackLinks.append( toggle );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( feedbackLinks.length ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Move feedback links before feedback.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Move the feedback links before the feedback section.
</ins><span class="cx" style="display: block; padding: 0 10px">                         var clonedElements = feedbackLinks.clone().children();
</span><span class="cx" style="display: block; padding: 0 10px">                        var feedbackLinksTop = $( '<div class="feedback-links"></div>' ).append( clonedElements );
</span><span class="cx" style="display: block; padding: 0 10px">                        $( this ).find( '.feedback' ).first().before( feedbackLinksTop );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       // Hide the bottom feedback links.
</ins><span class="cx" style="display: block; padding: 0 10px">                         feedbackLinks.addClass( 'bottom hide-if-js' );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        } );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -67,7 +73,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Removes added elements 
</span><span class="cx" style="display: block; padding: 0 10px">        function resetComment( el ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">                 var children = el.find( 'ul.children' );
</span><span class="cx" style="display: block; padding: 0 10px">                if ( !children.length ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        el.find( '.feedback-toggle' ).remove();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,32 +83,35 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Show hidden child comments if the fragment identifier is a comment ID (e.g. #comment-63).  
</span><span class="cx" style="display: block; padding: 0 10px">        $( document ).ready( function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Set wpAdminBar
+               wpAdminBar = $('#wpadminbar').length ? 32 : 0;
</ins><span class="cx" style="display: block; padding: 0 10px">                 var childComments = $( '.comment' ).find( 'ul.children' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( !( hash.length && childComments.length ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! ( commentID.length && childComments.length ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                var hashComment = childComments.find( hash ).first();
-               if ( hashComment.length ) {
-                       // Child comment exists.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         var comment = childComments.find( commentID + '.depth-2' ).first();
+               if ( ! comment.length ) {
+                       return;
+               }
+               // Child comment exists.
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var parent = hashComment.closest( '.comment.depth-1' );
-                       if ( parent.find( '.feedback' ).hasClass( 'hide-if-js' ) ) {
-                               // Show child comments.
-                               parent.find( '.feedback-toggle' ).first().trigger( 'click' );
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         var parent = comment.closest( '.comment.depth-1' );
+               if ( parent.find( '.feedback' ).hasClass( 'hide-if-js' ) ) {
+                       // Show child comments.
+                       parent.find( '.feedback-toggle' ).first().trigger( 'click' );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Scroll to the child comment.
-                       var pos = hashComment.offset();
-                       $( 'html,body' ).animate( {
-                               scrollTop: pos.top - wpAdminBar
-                       }, 1 );
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Scroll to child comment and adjust for admin bar
+               var pos = comment.offset();
+               $( 'html,body' ).animate( {
+                       scrollTop: pos.top - wpAdminBar
+               }, 1 );
+
</ins><span class="cx" style="display: block; padding: 0 10px">         } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Show/Hide feedback toggle link.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Click event for Show/Hide feedback toggle link.
</ins><span class="cx" style="display: block; padding: 0 10px">         $( document ).on( 'click', '.feedback-toggle', function( e ) {
</span><span class="cx" style="display: block; padding: 0 10px">                e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -130,7 +138,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                scrollTop: pos.top - wpAdminBar
</span><span class="cx" style="display: block; padding: 0 10px">                        }, 1000 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Add feedback links at the bottom if there are over 3 feedback notes.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Show feedback links at the bottom if there are over 3 feedback notes.
</ins><span class="cx" style="display: block; padding: 0 10px">                         var children = parent.find( 'ul.children > li' );
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( 3 < children.length ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                var feedbackLinks = parent.find( '.feedback-links.bottom' );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjsusernotespreviewjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-preview.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-preview.js      2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-preview.js        2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,6 +20,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                text = '';
</span><span class="cx" style="display: block; padding: 0 10px">                processing = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Show tabs with Javascript.
+               $( '#commentform .tablist').show();
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( textarea.length && preview.length && tabs.length ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Append spinner to preview tab
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjsusernotesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js      2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes.js        2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,17 +6,59 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ( function( $ ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        var commentForm = $( '.comment-form textarea' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        var add_user_note = $( '#add-user-note' );      
+       var commentID = window.location.hash;
+       var wpAdminBar = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( !commentForm.length ) {
-               return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Check if the fragment identifier is a comment ID (e.g. #comment-63)
+       if ( ! commentID.match( /#comment\-[0-9]+$/ ) ) {
+               commentID = '';
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        // Actions for when the page is ready
+       $( document ).ready( function() {
+               // Set wpAdminBar
+               wpAdminBar = $( '#wpadminbar' ).length ? 32 : 0;
+
+               // Display form and scroll to it
+               if ( '#respond' === window.location.hash ) {
+                       showCommentForm();
+               }
+
+               if( ! wpAdminBar || ! commentID ) {
+                       return;
+               }
+
+               var comment = $('#comments').find( commentID + '.depth-1' ).first();
+               if( ! comment.length  ) {
+                       return;
+               }
+
+               // Scroll to top level comment and adjust for admin bar.
+               var pos = comment.offset();
+               $( 'html,body' ).animate( {
+                       scrollTop: pos.top - wpAdminBar
+               }, 1 );
+       } );
+
+       // Scroll to comment if comment date link is clicked
+       $( '#comments' ).on( 'click', '.comment-date', function( e ) {
+               // Scroll to comment and adjust for admin bar
+               // Add 16px for child comments
+               var pos = $( this ).offset();
+               $( 'html,body' ).animate( {
+                       scrollTop: pos.top - wpAdminBar - 16
+               }, 1 );
+       } );
+
</ins><span class="cx" style="display: block; padding: 0 10px">         function showCommentForm() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if( add_user_note.length ) {
+                       add_user_note.hide();
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $( '#respond' ).show();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $( '#add-user-note' ).hide();
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                var wpAdminBar = $( '#page.admin-bar' ).length ? 32 : 0;
-               var target     = $( '#commentform #add-note-or-feedback' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         var target = $( '#commentform #add-note-or-feedback' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( target.length ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var pos = target.offset();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,17 +70,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $( '#respond, #add-user-note' ).toggle();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! commentForm.length ) {
+               return;
+       }
+
+       if( add_user_note.length ) {
+               add_user_note.show();
+
+               // Hide by default if #add-user-note exists
+               $( '#respond' ).hide();
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         $( '#add-user-note, .table-of-contents a[href="#add-note-or-feedback"]' ).click( function( e ) {
</span><span class="cx" style="display: block; padding: 0 10px">                e.preventDefault();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">                 showCommentForm();
</span><span class="cx" style="display: block; padding: 0 10px">        } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( '#respond' === document.location.hash ) {
-               showCommentForm();
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         // Add php and js buttons to QuickTags.
</span><span class="cx" style="display: block; padding: 0 10px">        QTags.addButton( 'php', 'php', '[php]', '[/php]', '', '', '', 'comment' );
</span><span class="cx" style="display: block; padding: 0 10px">        QTags.addButton( 'js', 'js', '[js]', '[/js]', '', '', '', 'comment' );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperscssmainscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss        2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss  2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1205,14 +1205,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        opacity: 1;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                .comment-awaiting-moderation {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         .comment-awaiting-moderation,
+               .comment-edited {
</ins><span class="cx" style="display: block; padding: 0 10px">                         background-color: #fff8e5;
</span><span class="cx" style="display: block; padding: 0 10px">                        padding: .2em .5em;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        margin-right: .5em;
</ins><span class="cx" style="display: block; padding: 0 10px">                         border-radius: 3px;
</span><span class="cx" style="display: block; padding: 0 10px">                        border: 1px solid #ffb900;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                .depth-2 .comment-awaiting-moderation {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         .depth-2 .comment-awaiting-moderation,
+               .depth-2 .comment-edited {
</ins><span class="cx" style="display: block; padding: 0 10px">                         display: inline-block;
</span><span class="cx" style="display: block; padding: 0 10px">                        margin: 2px 0;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1238,7 +1241,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                .comment-list li.depth-1,
</span><span class="cx" style="display: block; padding: 0 10px">                #comment-preview {
</span><span class="cx" style="display: block; padding: 0 10px">                        border: 1px solid #dfdfdf;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        border-radius: 2px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 border-radius: 2px;     
+                       width: 100%;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Feedback
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1430,9 +1434,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        padding: 0 5px;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                .comment-form ul {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         .comment-form ul, .feedback-form ul {
</ins><span class="cx" style="display: block; padding: 0 10px">                         margin-left: 1.5em;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               .feedback-form ul li {
+                       margin: 0;
+                       overflow: visible;
+               }
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        &.single-post {
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperstylesheetsmaincss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css  2018-10-19 21:19:46 UTC (rev 7753)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css    2018-10-19 22:56:22 UTC (rev 7754)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1587,14 +1587,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">   opacity: 1;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.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 {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.devhub-wrap .single-wp-parser-function .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-function .comment-edited, .devhub-wrap .single-wp-parser-method .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-method .comment-edited, .devhub-wrap .single-wp-parser-hook .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-hook .comment-edited, .devhub-wrap .single-wp-parser-class .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-class .comment-edited {
</ins><span class="cx" style="display: block; padding: 0 10px">   background-color: #fff8e5;
</span><span class="cx" style="display: block; padding: 0 10px">   padding: .2em .5em;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  margin-right: .5em;
</ins><span class="cx" style="display: block; padding: 0 10px">   border-radius: 3px;
</span><span class="cx" style="display: block; padding: 0 10px">   border: 1px solid #ffb900;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.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 {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.devhub-wrap .single-wp-parser-function .depth-2 .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-function .depth-2 .comment-edited, .devhub-wrap .single-wp-parser-method .depth-2 .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-method .depth-2 .comment-edited, .devhub-wrap .single-wp-parser-hook .depth-2 .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-hook .depth-2 .comment-edited, .devhub-wrap .single-wp-parser-class .depth-2 .comment-awaiting-moderation,
+.devhub-wrap .single-wp-parser-class .depth-2 .comment-edited {
</ins><span class="cx" style="display: block; padding: 0 10px">   display: inline-block;
</span><span class="cx" style="display: block; padding: 0 10px">   margin: 2px 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1634,6 +1643,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> .devhub-wrap .single-wp-parser-class #comment-preview {
</span><span class="cx" style="display: block; padding: 0 10px">   border: 1px solid #dfdfdf;
</span><span class="cx" style="display: block; padding: 0 10px">   border-radius: 2px;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  width: 100%;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> .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 {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1808,10 +1818,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">   padding: 0 5px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.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 {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.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 {
</ins><span class="cx" style="display: block; padding: 0 10px">   margin-left: 1.5em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.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 {
+  margin: 0;
+  overflow: visible;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .devhub-wrap.single-post .comment-list,
</span><span class="cx" style="display: block; padding: 0 10px"> .devhub-wrap.single-post .comment-list ol {
</span><span class="cx" style="display: block; padding: 0 10px">   list-style: none;
</span></span></pre>
</div>
</div>

</body>
</html>