Fixed response loading via anchor
authorAlexander Ebert <ebert@woltlab.com>
Fri, 25 Aug 2017 15:58:45 +0000 (17:58 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 25 Aug 2017 15:58:45 +0000 (17:58 +0200)
Fixes #2400

wcfsetup/install/files/js/WCF.Comment.js
wcfsetup/install/files/lib/data/comment/CommentAction.class.php

index 24745ef56cf70dca1b2c382a343ecd1daa9380d9..acd0bdf07373eb08526883c6929df3ac1d9c8d23 100644 (file)
@@ -877,8 +877,6 @@ WCF.Comment.Handler = Class.extend({
                        return;
                }
                
-               // TODO: handle 'response' value
-               
                $(data.returnValues.template).insertBefore(this._permalinkComment);
                var comment = this._permalinkComment.previousElementSibling;
                comment.classList.add('commentPermalinkContainer');
@@ -886,6 +884,20 @@ WCF.Comment.Handler = Class.extend({
                elRemove(this._permalinkComment);
                this._permalinkComment = comment;
                
+               if (data.returnValues.response) {
+                       this._permalinkResponse = elCreate('li');
+                       this._permalinkResponse.className = 'commentResponsePermalinkContainer loading';
+                       this._permalinkResponse.innerHTML = '<span class="icon icon32 fa-spinner"></span>';
+                       var responseList = elBySel('.commentResponseList', comment);
+                       responseList.insertBefore(this._permalinkResponse, responseList.firstChild);
+                       
+                       this._insertResponse({
+                               returnValues: {
+                                       template: data.returnValues.response
+                               }
+                       });
+               }
+               
                //noinspection BadExpressionStatementJS
                comment.offsetTop;
                
index f764ced8ce8ba1951f8f6ac3f07d706271991439..d3b1c133100312cf9e78380e033923e80bcbd7d4 100644 (file)
@@ -931,8 +931,8 @@ class CommentAction extends AbstractDatabaseObjectAction implements IMessageInli
                        }
                }
                
-               // load last response time for comment-only requests
-               if ($response === null && $comment->getDecoratedObject()->responses) {
+               // load last response time
+               if ($comment->getDecoratedObject()->responses) {
                        $sql = "SELECT          time
                                FROM            wcf".WCF_N."_comment_response
                                WHERE           commentID = ?