summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/boards/boardHeader.jade4
-rw-r--r--client/components/boards/boardHeader.js6
-rw-r--r--client/components/cards/cardDate.jade12
-rw-r--r--client/components/cards/cardDate.js6
-rw-r--r--client/components/cards/cardDetails.jade2
-rw-r--r--client/components/cards/cardDetails.js4
-rw-r--r--client/components/cards/checklists.jade21
-rw-r--r--client/components/cards/checklists.js6
-rw-r--r--client/components/lists/list.js4
-rw-r--r--client/components/sidebar/sidebar.jade2
-rw-r--r--models/lists.js6
-rw-r--r--models/users.js5
-rw-r--r--server/lib/utils.js4
13 files changed, 64 insertions, 18 deletions
diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade
index 599ad20a..e61aea35 100644
--- a/client/components/boards/boardHeader.jade
+++ b/client/components/boards/boardHeader.jade
@@ -65,7 +65,7 @@ template(name="boardHeaderBar")
if $eq watchLevel "muted"
i.fa.fa-bell-slash
span {{_ watchLevel}}
-
+
else
a.board-header-btn.js-log-in(
title="{{_ 'log-in'}}")
@@ -81,7 +81,7 @@ template(name="boardHeaderBar")
a.board-header-btn-close.js-filter-reset(title="{{_ 'filter-clear'}}")
i.fa.fa-times-thin
- if currentUser.isBoardMember
+ if canModifyBoard
a.board-header-btn.js-multiselection-activate(
title="{{#if MultiSelection.isActive}}{{_ 'multi-selection-on'}}{{else}}{{_ 'multi-selection'}}{{/if}}"
class="{{#if MultiSelection.isActive}}emphasis{{/if}}")
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index 9b03ab56..44532c3e 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -97,6 +97,12 @@ BlazeComponent.extendComponent({
},
}).register('boardHeaderBar');
+Template.boardHeaderBar.helpers({
+ canModifyBoard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
+
BlazeComponent.extendComponent({
backgroundColors() {
return Boards.simpleSchema()._schema.color.allowedValues;
diff --git a/client/components/cards/cardDate.jade b/client/components/cards/cardDate.jade
index a2a28bbd..525f27ed 100644
--- a/client/components/cards/cardDate.jade
+++ b/client/components/cards/cardDate.jade
@@ -15,6 +15,12 @@ template(name="editCardDate")
button.js-delete-date.negate.wide.right.js-delete-date {{_ 'delete'}}
template(name="dateBadge")
- a.js-edit-date.card-date(title="{{showTitle}}" class="{{classes}}")
- time(datetime="{{showISODate}}")
- | {{showDate}}
+ if canModifyCard
+ a.js-edit-date.card-date(title="{{showTitle}}" class="{{classes}}")
+ time(datetime="{{showISODate}}")
+ | {{showDate}}
+ else
+ a.card-date(title="{{showTitle}}" class="{{classes}}")
+ time(datetime="{{showISODate}}")
+ | {{showDate}}
+
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js
index 4d129e8e..3f69f384 100644
--- a/client/components/cards/cardDate.js
+++ b/client/components/cards/cardDate.js
@@ -86,6 +86,12 @@ const EditCardDate = BlazeComponent.extendComponent({
},
});
+Template.dateBadge.helpers({
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
+
// editCardStartDatePopup
(class extends EditCardDate {
onCreated() {
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade
index 0c707eac..9c95e92f 100644
--- a/client/components/cards/cardDetails.jade
+++ b/client/components/cards/cardDetails.jade
@@ -28,7 +28,7 @@ template(name="cardDetails")
.card-details-item.card-details-item-labels
h3.card-details-item-title {{_ 'labels'}}
- a(class="{{#if currentUser.isBoardMember}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
+ a(class="{{#if canModifyCard}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
each labels
span.card-label(class="card-label-{{color}}" title=name)= name
if canModifyCard
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index ade1742d..b39f8e59 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -144,6 +144,10 @@ Template.cardDetailsActionsPopup.helpers({
isWatching() {
return this.findWatcher(Meteor.userId());
},
+
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
});
Template.cardDetailsActionsPopup.events({
diff --git a/client/components/cards/checklists.jade b/client/components/cards/checklists.jade
index d84f47f4..a0d89351 100644
--- a/client/components/cards/checklists.jade
+++ b/client/components/cards/checklists.jade
@@ -17,9 +17,13 @@ template(name="checklistDetail")
else
.checklist-title
.checkbox.fa.fa-check-square-o
- a.js-delete-checklist {{_ "delete"}}...
+ if canModifyCard
+ a.js-delete-checklist {{_ "delete"}}...
span.checklist-stat(class="{{#if checklist.isFinished}}is-finished{{/if}}") {{checklist.finishedCount}}/{{checklist.itemCount}}
- h2.title.js-open-inlined-form.is-editable {{checklist.title}}
+ if canModifyCard
+ h2.title.js-open-inlined-form.is-editable {{checklist.title}}
+ else
+ h2.title {{checklist.title}}
+checklistItems(checklist = checklist)
template(name="addChecklistItemForm")
@@ -38,7 +42,7 @@ template(name="editChecklistItemForm")
button.primary.confirm.js-submit-edit-checklist-item-form(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
span(title=createdAt) {{ moment createdAt }}
- if currentUser.isBoardMember
+ if canModifyCard
a.js-delete-checklist-item {{_ "delete"}}...
template(name="checklistItems")
@@ -48,7 +52,7 @@ template(name="checklistItems")
+editChecklistItemForm(type = 'item' item = item checklist = checklist)
else
+itemDetail(item = item checklist = checklist)
- if currentUser.isBoardMember
+ if canModifyCard
+inlinedForm(classNames="js-add-checklist-item" checklist = checklist)
+addChecklistItemForm
else
@@ -58,5 +62,10 @@ template(name="checklistItems")
template(name='itemDetail')
.item
- .check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
- .item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
+ if canModifyCard
+ .check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
+ .item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
+ else
+ .materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
+ .item-title(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
+
diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js
index 4e5b1b25..b8f5e443 100644
--- a/client/components/cards/checklists.js
+++ b/client/components/cards/checklists.js
@@ -77,6 +77,12 @@ BlazeComponent.extendComponent({
},
}).register('checklists');
+Template.itemDetail.helpers({
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
+
BlazeComponent.extendComponent({
toggleItem() {
const checklist = this.currentData().checklist;
diff --git a/client/components/lists/list.js b/client/components/lists/list.js
index 187d8ec3..9c191348 100644
--- a/client/components/lists/list.js
+++ b/client/components/lists/list.js
@@ -79,10 +79,10 @@ BlazeComponent.extendComponent({
});
function userIsMember() {
- return Meteor.user() && Meteor.user().isBoardMember();
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
}
- // Disable drag-dropping if the current user is not a board member
+ // Disable drag-dropping if the current user is not a board member or is comment only
this.autorun(() => {
$cards.sortable('option', 'disabled', !userIsMember());
});
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade
index 3894de5e..6045b371 100644
--- a/client/components/sidebar/sidebar.jade
+++ b/client/components/sidebar/sidebar.jade
@@ -60,7 +60,7 @@ template(name="labelsWidget")
.board-widget-content
each currentBoard.labels
a.card-label(class="card-label-{{color}}"
- class="{{#if currentUser.isBoardMember}}js-label{{/if}}")
+ class="{{#if currentUser.isNotCommentOnly}}js-label{{/if}}")
span.card-label-name= name
if currentUser.isBoardAdmin
a.card-label.add-label.js-add-label
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 3073e759..f062df9d 100644
--- a/models/users.js
+++ b/models/users.js
@@ -117,6 +117,11 @@ 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);
diff --git a/server/lib/utils.js b/server/lib/utils.js
index bc3807bb..c7763933 100644
--- a/server/lib/utils.js
+++ b/server/lib/utils.js
@@ -6,6 +6,10 @@ allowIsBoardMember = function(userId, board) {
return board && board.hasMember(userId);
};
+allowIsBoardMemberNonComment = function(userId, board) {
+ return board && board.hasMember(userId) && !board.hasCommentOnly(userId);
+};
+
allowIsBoardMemberByCard = function(userId, card) {
const board = card.board();
return board && board.hasMember(userId);