Переглянути джерело

cant see add list if comment only

Ryan Helsing 8 роки тому
батько
коміт
383daf6f64

+ 1 - 1
client/components/boards/boardBody.jade

@@ -25,7 +25,7 @@ template(name="boardBody")
           +list(this)
           +list(this)
           if currentCardIsInThisList
           if currentCardIsInThisList
             +cardDetails(currentCard)
             +cardDetails(currentCard)
-        if currentUser.isBoardMember
+        if canSeeAddList
           +addListForm
           +addListForm
 
 
 template(name="addListForm")
 template(name="addListForm")

+ 6 - 0
client/components/boards/boardBody.js

@@ -204,3 +204,9 @@ BlazeComponent.extendComponent({
     }];
     }];
   },
   },
 }).register('addListForm');
 }).register('addListForm');
+
+Template.boardBody.helpers({
+  canSeeAddList() {
+    return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+  },
+});

+ 5 - 0
models/users.js

@@ -117,6 +117,11 @@ if (Meteor.isClient) {
       return board && board.hasMember(this._id);
       return board && board.hasMember(this._id);
     },
     },
 
 
+    isCommentOnly() {
+      const board = Boards.findOne(Session.get('currentBoard'));
+      return board && board.hasCommentOnly(this._id);
+    },
+
     isBoardAdmin() {
     isBoardAdmin() {
       const board = Boards.findOne(Session.get('currentBoard'));
       const board = Boards.findOne(Session.get('currentBoard'));
       return board && board.hasAdmin(this._id);
       return board && board.hasAdmin(this._id);