summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/boards.js11
-rw-r--r--models/lists.js6
-rw-r--r--models/users.js10
3 files changed, 23 insertions, 4 deletions
diff --git a/models/boards.js b/models/boards.js
index 9323d690..4492d299 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -107,6 +107,7 @@ Boards.attachSchema(new SimpleSchema({
userId: this.userId,
isAdmin: true,
isActive: true,
+ isCommentOnly: false,
}];
}
},
@@ -120,6 +121,9 @@ Boards.attachSchema(new SimpleSchema({
'members.$.isActive': {
type: Boolean,
},
+ 'members.$.isCommentOnly': {
+ type: Boolean,
+ },
permission: {
type: String,
allowedValues: ['public', 'private'],
@@ -219,6 +223,10 @@ Boards.helpers({
return !!_.findWhere(this.members, {userId: memberId, isActive: true, isAdmin: true});
},
+ hasCommentOnly(memberId) {
+ return !!_.findWhere(this.members, {userId: memberId, isActive: true, isAdmin: false, isCommentOnly: true});
+ },
+
absoluteUrl() {
return FlowRouter.url('board', { id: this._id, slug: this.slug });
},
@@ -332,7 +340,7 @@ Boards.mutations({
};
},
- setMemberPermission(memberId, isAdmin) {
+ setMemberPermission(memberId, isAdmin, isCommentOnly) {
const memberIndex = this.memberIndex(memberId);
// do not allow change permission of self
@@ -343,6 +351,7 @@ Boards.mutations({
return {
$set: {
[`members.${memberIndex}.isAdmin`]: isAdmin,
+ [`members.${memberIndex}.isCommentOnly`]: isCommentOnly,
},
};
},
diff --git a/models/lists.js b/models/lists.js
index 682fb096..0ae3ca5f 100644
--- a/models/lists.js
+++ b/models/lists.js
@@ -46,13 +46,13 @@ Lists.attachSchema(new SimpleSchema({
Lists.allow({
insert(userId, doc) {
- return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
+ return allowIsBoardMemberNonComment(userId, Boards.findOne(doc.boardId));
},
update(userId, doc) {
- return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
+ return allowIsBoardMemberNonComment(userId, Boards.findOne(doc.boardId));
},
remove(userId, doc) {
- return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
+ return allowIsBoardMemberNonComment(userId, Boards.findOne(doc.boardId));
},
fetch: ['boardId'],
});
diff --git a/models/users.js b/models/users.js
index f944d7b1..edf1a203 100644
--- a/models/users.js
+++ b/models/users.js
@@ -121,6 +121,16 @@ if (Meteor.isClient) {
return board && board.hasMember(this._id);
},
+ isNotCommentOnly() {
+ const board = Boards.findOne(Session.get('currentBoard'));
+ return board && board.hasMember(this._id) && !board.hasCommentOnly(this._id);
+ },
+
+ isCommentOnly() {
+ const board = Boards.findOne(Session.get('currentBoard'));
+ return board && board.hasCommentOnly(this._id);
+ },
+
isBoardAdmin() {
const board = Boards.findOne(Session.get('currentBoard'));
return board && board.hasAdmin(this._id);