summaryrefslogtreecommitdiffstats
path: root/client/components/boards
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/boards
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/boards')
-rw-r--r--client/components/boards/boardBody.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js
index aa55baad..9c1625cd 100644
--- a/client/components/boards/boardBody.js
+++ b/client/components/boards/boardBody.js
@@ -135,9 +135,6 @@ Template.boardBody.onRendered(function() {
},
};
- if (!Meteor.user() || !Meteor.user().isBoardMember())
- return;
-
$(self.listsDom).sortable({
tolerance: 'pointer',
helper: 'clone',
@@ -163,16 +160,21 @@ Template.boardBody.onRendered(function() {
},
});
- // Disable drag-dropping while in multi-selection mode
+ function userIsMember() {
+ return Meteor.user() && Meteor.user().isBoardMember();
+ }
+
+ // Disable drag-dropping while in multi-selection mode, or if the current user
+ // is not a board member
self.autorun(() => {
$(self.listsDom).sortable('option', 'disabled',
- MultiSelection.isActive());
+ MultiSelection.isActive() || !userIsMember());
});
// If there is no data in the board (ie, no lists) we autofocus the list
// creation form by clicking on the corresponding element.
const currentBoard = Boards.findOne(Session.get('currentBoard'));
- if (currentBoard.lists().count() === 0) {
+ if (userIsMember() && currentBoard.lists().count() === 0) {
self.openNewListForm();
}
});