From: Matthias Schmidt Date: Sun, 31 Jul 2016 08:03:44 +0000 (+0200) Subject: Fix like handler if user cannot dislike X-Git-Tag: 3.0.0_Beta_1~857 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a6c836c34d908b48325fda06224630dcfa6480a8;p=GitHub%2FWoltLab%2FWCF.git Fix like handler if user cannot dislike --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js index 5708adad51..1af428c35f 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js @@ -319,17 +319,20 @@ define( _updateActiveState: function(element) { var data = this._containers.get(element); - var dislikeTarget = (this._options.markListItemAsActive) ? data.dislikeButton.parentNode : data.dislikeButton; var likeTarget = (this._options.markListItemAsActive) ? data.likeButton.parentNode : data.likeButton; - - if (data.dislikeButton !== null) dislikeTarget.classList.remove('active'); likeTarget.classList.remove('active'); if (data.liked === 1) { likeTarget.classList.add('active'); } - else if (data.liked === -1 && data.dislikeButton !== null) { - dislikeTarget.classList.add('active'); + + if (this._options.canDislike) { + var dislikeTarget = (this._options.markListItemAsActive) ? data.dislikeButton.parentNode : data.dislikeButton; + dislikeTarget.classList.remove('active'); + + if (data.liked === -1) { + dislikeTarget.classList.add('active'); + } } },