WordPress.org

Make WordPress Core

Changeset 49187


Ignore:
Timestamp:
10/18/2020 06:39:21 AM (5 weeks ago)
Author:
SergeyBiryukov
Message:

Comments: Hide the link to the initial parent comment in the reply heading when replying to another comment.

This ensures that the reply heading is updated correctly on single post URLs with the ?replytocom query argument.

Follow-up to [47506], [48876], [48904].

Props mailnew2ster, wpamitkumar, audrasjb, desrosj, SergeyBiryukov.
Fixes #51175.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/comment-reply.js

    r49097 r49187  
    179179        var replyHeadingElement  = getElementById( config.commentReplyTitleId );
    180180        var replyHeadingTextNode = replyHeadingElement && replyHeadingElement.firstChild;
     181        var replyLinkToParent    = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
    181182
    182183        if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE && headingText ) {
     184            if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
     185                replyLinkToParent.style.display = '';
     186            }
     187
    183188            replyHeadingTextNode.textContent = headingText;
    184189        }
     
    320325        var replyHeading         = getElementById( config.commentReplyTitleId );
    321326        var replyHeadingTextNode = replyHeading && replyHeading.firstChild;
     327        var replyLinkToParent    = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
    322328
    323329        if ( ! addBelowElement || ! respondElement || ! parentIdField ) {
     
    343349
    344350        if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE ) {
     351            if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
     352                replyLinkToParent.style.display = 'none';
     353            }
     354
    345355            replyHeadingTextNode.textContent = replyTo;
    346356        }
Note: See TracChangeset for help on using the changeset viewer.