summaryrefslogtreecommitdiffstats
path: root/client/components/lists
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-12-29 18:08:24 +0100
committerMaxime Quandalle <maxime@quandalle.com>2015-12-30 19:22:30 +0100
commitf6c01161a02e273b87c9f6cc02d3809b997241ba (patch)
tree77e2199c414070b8663bba4ba24f4167013081a7 /client/components/lists
parent46bf6ef80376e6fee0fb15e518373bf194ab961d (diff)
downloadwekan-f6c01161a02e273b87c9f6cc02d3809b997241ba.tar.gz
wekan-f6c01161a02e273b87c9f6cc02d3809b997241ba.tar.bz2
wekan-f6c01161a02e273b87c9f6cc02d3809b997241ba.zip
Fix drag and drop on Sandstorm
This bug was introduced with the introduction of fast-render in 41b23f8. With fast-render data is available instantly after the page logging, but calls to `Meteor.userId()` still return `null` as the user isn't authenticated on the DDP channel yet (previously the data was loaded on DDP after user authentication). Which mean that we know need to reactively activate Drag and Drop on user log in. I'm not sure why I was not able to reproduce this bug outside of Sandstorm. Fixes #453
Diffstat (limited to 'client/components/lists')
-rw-r--r--client/components/lists/list.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/client/components/lists/list.js b/client/components/lists/list.js
index f5410ed0..e454cb48 100644
--- a/client/components/lists/list.js
+++ b/client/components/lists/list.js
@@ -22,9 +22,6 @@ BlazeComponent.extendComponent({
// callback, we basically solve all issues related to reactive updates. A
// comment below provides further details.
onRendered() {
- if (!Meteor.user() || !Meteor.user().isBoardMember())
- return;
-
const boardComponent = this.parentComponent();
const itemsSelector = '.js-minicard:not(.placeholder, .js-card-composer)';
const $cards = this.$('.js-minicards');
@@ -85,6 +82,15 @@ BlazeComponent.extendComponent({
},
});
+ function userIsMember() {
+ return Meteor.user() && Meteor.user().isBoardMember();
+ }
+
+ // Disable drag-dropping if the current user is not a board member
+ this.autorun(() => {
+ $cards.sortable('option', 'disabled', !userIsMember());
+ });
+
// We want to re-run this function any time a card is added.
this.autorun(() => {
const currentBoardId = Tracker.nonreactive(() => {