From e90b8972c7f40f7636f9c16382f43f243093a0e0 Mon Sep 17 00:00:00 2001 From: rr- Date: Tue, 23 Aug 2016 21:30:53 +0200 Subject: [PATCH] client/auth: fix being able to rate/fav things --- client/css/comments.styl | 3 ++- client/html/score.tpl | 2 +- client/js/controllers/post_controller.js | 9 +++++++++ client/js/controls/comment_control.js | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/client/css/comments.styl b/client/css/comments.styl index 59e2cfb..570148e 100644 --- a/client/css/comments.styl +++ b/client/css/comments.styl @@ -85,7 +85,8 @@ margin-left: 2em font-size: 95% .edit, .delete, .score-container a, .nickname a - color: mix($main-color, $inactive-tab-text-color) + &:not(.inactive) + color: mix($main-color, $inactive-tab-text-color) .edit, .delete font-size: 80% diff --git a/client/html/score.tpl b/client/html/score.tpl index 745c03e..c190069 100644 --- a/client/html/score.tpl +++ b/client/html/score.tpl @@ -9,7 +9,7 @@ like <% } else { %> - + <% } %> diff --git a/client/js/controllers/post_controller.js b/client/js/controllers/post_controller.js index ac569eb..c1228b6 100644 --- a/client/js/controllers/post_controller.js +++ b/client/js/controllers/post_controller.js @@ -222,6 +222,9 @@ class PostController { } _evtScorePost(e) { + if (!api.hasPrivilege('posts:score')) { + return; + } e.detail.post.setScore(e.detail.score) .catch(errorMessage => { window.alert(errorMessage); @@ -229,6 +232,9 @@ class PostController { } _evtFavoritePost(e) { + if (!api.hasPrivilege('posts:favorite')) { + return; + } e.detail.post.addToFavorites() .catch(errorMessage => { window.alert(errorMessage); @@ -236,6 +242,9 @@ class PostController { } _evtUnfavoritePost(e) { + if (!api.hasPrivilege('posts:favorite')) { + return; + } e.detail.post.removeFromFavorites() .catch(errorMessage => { window.alert(errorMessage); diff --git a/client/js/controls/comment_control.js b/client/js/controls/comment_control.js index 83fee15..63216e7 100644 --- a/client/js/controls/comment_control.js +++ b/client/js/controls/comment_control.js @@ -90,6 +90,9 @@ class CommentControl extends events.EventTarget { _evtScoreClick(e, score) { e.preventDefault(); + if (!api.hasPrivilege('comments:score')) { + return; + } this.dispatchEvent(new CustomEvent('score', { detail: { comment: this._comment,