From 005b2ff11a88411f8d60878ec8ff5bb61a224644 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 25 Aug 2017 17:58:45 +0200 Subject: [PATCH] Fixed response loading via anchor Fixes #2400 --- wcfsetup/install/files/js/WCF.Comment.js | 16 ++++++++++++++-- .../lib/data/comment/CommentAction.class.php | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.Comment.js b/wcfsetup/install/files/js/WCF.Comment.js index 24745ef56c..acd0bdf073 100644 --- a/wcfsetup/install/files/js/WCF.Comment.js +++ b/wcfsetup/install/files/js/WCF.Comment.js @@ -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 = ''; + var responseList = elBySel('.commentResponseList', comment); + responseList.insertBefore(this._permalinkResponse, responseList.firstChild); + + this._insertResponse({ + returnValues: { + template: data.returnValues.response + } + }); + } + //noinspection BadExpressionStatementJS comment.offsetTop; diff --git a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php index f764ced8ce..d3b1c13310 100644 --- a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php @@ -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 = ? -- 2.20.1