diff options
author | Lauri Ojansivu <x@xet7.org> | 2018-09-04 20:09:36 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2018-09-04 20:09:36 +0300 |
commit | 77efcf71376d3da6c19ad1a4910567263e83c0ca (patch) | |
tree | cf771daed5671379fa616fbb6aed42baab8834d5 /client/components/sidebar/sidebar.js | |
parent | bcbe1aaaf561f3188111b586ad0734b983206482 (diff) | |
download | wekan-77efcf71376d3da6c19ad1a4910567263e83c0ca.tar.gz wekan-77efcf71376d3da6c19ad1a4910567263e83c0ca.tar.bz2 wekan-77efcf71376d3da6c19ad1a4910567263e83c0ca.zip |
- Add permission "No comments". It is like normal user, but does not show comments and activities.
Thanks to xet7 !
Diffstat (limited to 'client/components/sidebar/sidebar.js')
-rw-r--r-- | client/components/sidebar/sidebar.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 5a9de74b..5d34c4a8 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -126,8 +126,11 @@ Template.memberPopup.helpers({ if(type === 'normal'){ const currentBoard = Boards.findOne(Session.get('currentBoard')); const commentOnly = currentBoard.hasCommentOnly(this.userId); + const noComments = currentBoard.hasNoComments(this.userId); if(commentOnly){ return TAPi18n.__('comment-only').toLowerCase(); + } else if(noComments) { + return TAPi18n.__('no-comments').toLowerCase(); } else { return TAPi18n.__(type).toLowerCase(); } @@ -324,12 +327,13 @@ BlazeComponent.extendComponent({ }).register('addMemberPopup'); Template.changePermissionsPopup.events({ - 'click .js-set-admin, click .js-set-normal, click .js-set-comment-only'(event) { + 'click .js-set-admin, click .js-set-normal, click .js-set-no-comments, click .js-set-comment-only'(event) { const currentBoard = Boards.findOne(Session.get('currentBoard')); const memberId = this.userId; const isAdmin = $(event.currentTarget).hasClass('js-set-admin'); const isCommentOnly = $(event.currentTarget).hasClass('js-set-comment-only'); - currentBoard.setMemberPermission(memberId, isAdmin, isCommentOnly); + const isNoComments = $(event.currentTarget).hasClass('js-set-no-comments'); + currentBoard.setMemberPermission(memberId, isAdmin, isNoComments, isCommentOnly); Popup.back(1); }, }); @@ -342,7 +346,12 @@ Template.changePermissionsPopup.helpers({ isNormal() { const currentBoard = Boards.findOne(Session.get('currentBoard')); - return !currentBoard.hasAdmin(this.userId) && !currentBoard.hasCommentOnly(this.userId); + return !currentBoard.hasAdmin(this.userId) && !currentBoard.hasNoComments(this.userId) && !currentBoard.hasCommentOnly(this.userId); + }, + + isNoComments() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return !currentBoard.hasAdmin(this.userId) && currentBoard.hasNoComments(this.userId); }, isCommentOnly() { |