Remove permalink response if it was loaded
authorAlexander Ebert <ebert@woltlab.com>
Mon, 6 Mar 2017 11:01:47 +0000 (12:01 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 6 Mar 2017 11:01:47 +0000 (12:01 +0100)
See #2231

wcfsetup/install/files/js/WCF.Comment.js

index da8751670c5013f51965448f0f4c48885528bb84..92654a58ff115bd9ffa8c53e9e16b1a89e61eff2 100644 (file)
@@ -860,6 +860,16 @@ WCF.Comment.Handler = Class.extend({
                
                // update button state to load next responses
                this._handleLoadNextResponses(data.returnValues.commentID);
+               
+               // check if permalink response has been loaded and remove it from view
+               if (this._permalinkResponse) {
+                       var responseId = elData(this._permalinkResponse, 'object-id');
+                       
+                       if (elBySel('.commentResponse[data-object-id="' + responseId + '"]:not(.commentPermalinkContainer)', this._container[0]) !== null) {
+                               elRemove(this._permalinkResponse);
+                               this._permalinkResponse = null;
+                       }
+               }
        },
        
        /**