client/auth: fix being able to rate/fav things

This commit is contained in:
rr- 2016-08-23 21:30:53 +02:00
parent 4ca7c49239
commit e90b8972c7
4 changed files with 15 additions and 2 deletions

View file

@ -85,7 +85,8 @@
margin-left: 2em margin-left: 2em
font-size: 95% font-size: 95%
.edit, .delete, .score-container a, .nickname a .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 .edit, .delete
font-size: 80% font-size: 80%

View file

@ -9,7 +9,7 @@
<span class='vim-nav-hint'>like</span> <span class='vim-nav-hint'>like</span>
</a> </a>
<% } else { %> <% } else { %>
<a href class='upvote inactive'> <a class='upvote inactive'>
<i class='fa fa-thumbs-o-up'></i> <i class='fa fa-thumbs-o-up'></i>
</a> </a>
<% } %> <% } %>

View file

@ -222,6 +222,9 @@ class PostController {
} }
_evtScorePost(e) { _evtScorePost(e) {
if (!api.hasPrivilege('posts:score')) {
return;
}
e.detail.post.setScore(e.detail.score) e.detail.post.setScore(e.detail.score)
.catch(errorMessage => { .catch(errorMessage => {
window.alert(errorMessage); window.alert(errorMessage);
@ -229,6 +232,9 @@ class PostController {
} }
_evtFavoritePost(e) { _evtFavoritePost(e) {
if (!api.hasPrivilege('posts:favorite')) {
return;
}
e.detail.post.addToFavorites() e.detail.post.addToFavorites()
.catch(errorMessage => { .catch(errorMessage => {
window.alert(errorMessage); window.alert(errorMessage);
@ -236,6 +242,9 @@ class PostController {
} }
_evtUnfavoritePost(e) { _evtUnfavoritePost(e) {
if (!api.hasPrivilege('posts:favorite')) {
return;
}
e.detail.post.removeFromFavorites() e.detail.post.removeFromFavorites()
.catch(errorMessage => { .catch(errorMessage => {
window.alert(errorMessage); window.alert(errorMessage);

View file

@ -90,6 +90,9 @@ class CommentControl extends events.EventTarget {
_evtScoreClick(e, score) { _evtScoreClick(e, score) {
e.preventDefault(); e.preventDefault();
if (!api.hasPrivilege('comments:score')) {
return;
}
this.dispatchEvent(new CustomEvent('score', { this.dispatchEvent(new CustomEvent('score', {
detail: { detail: {
comment: this._comment, comment: this._comment,