From 64ee60a008c929dcf63ac5d2c49f7f189508a757 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Thu, 9 May 2019 14:32:38 +0300 Subject: Fix missing profile checks. Thanks to justinr1234 ! --- client/components/lists/list.js | 4 ++-- client/components/lists/listBody.js | 18 +++++++++--------- client/components/lists/listHeader.js | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'client/components/lists') diff --git a/client/components/lists/list.js b/client/components/lists/list.js index 12932a82..ea0068eb 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -69,10 +69,10 @@ BlazeComponent.extendComponent({ const listId = Blaze.getData(ui.item.parents('.list').get(0))._id; const currentBoard = Boards.findOne(Session.get('currentBoard')); let swimlaneId = ''; - const boardView = Meteor.user().profile.boardView; + const boardView = (Meteor.user().profile || {}).boardView; if (boardView === 'board-view-swimlanes' || currentBoard.isTemplatesBoard()) swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id; - else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal')) + else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal') || !boardView) swimlaneId = currentBoard.getDefaultSwimline()._id; // Normally the jquery-ui sortable library moves the dragged DOM element diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 43619890..a5ccba3f 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -48,7 +48,7 @@ BlazeComponent.extendComponent({ const board = this.data().board(); let linkedId = ''; let swimlaneId = ''; - const boardView = Meteor.user().profile.boardView; + const boardView = (Meteor.user().profile || {}).boardView; let cardType = 'cardType-card'; if (title) { if (board.isTemplatesBoard()) { @@ -72,7 +72,7 @@ BlazeComponent.extendComponent({ } } else if (boardView === 'board-view-swimlanes') swimlaneId = this.parentComponent().parentComponent().data()._id; - else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal')) + else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal') || !boardView) swimlaneId = board.getDefaultSwimline()._id; const _id = Cards.insert({ @@ -149,7 +149,7 @@ BlazeComponent.extendComponent({ idOrNull(swimlaneId) { const currentUser = Meteor.user(); - if (currentUser.profile.boardView === 'board-view-swimlanes' || + if ((currentUser.profile || {}).boardView === 'board-view-swimlanes' || this.data().board().isTemplatesBoard()) return swimlaneId; return undefined; @@ -356,10 +356,10 @@ BlazeComponent.extendComponent({ // Swimlane where to insert card const swimlane = $(Popup._getTopStack().openerElement).closest('.js-swimlane'); this.swimlaneId = ''; - const boardView = Meteor.user().profile.boardView; + const boardView = (Meteor.user().profile || {}).boardView; if (boardView === 'board-view-swimlanes') this.swimlaneId = Blaze.getData(swimlane[0])._id; - else if (boardView === 'board-view-lists') + else if (boardView === 'board-view-lists' || !boardView) this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id; }, @@ -485,13 +485,13 @@ BlazeComponent.extendComponent({ this.isBoardTemplateSearch; let board = {}; if (this.isTemplateSearch) { - board = Boards.findOne(Meteor.user().profile.templatesBoardId); + board = Boards.findOne((Meteor.user().profile || {}).templatesBoardId); } else { // Prefetch first non-current board id board = Boards.findOne({ archived: false, 'members.userId': Meteor.userId(), - _id: {$nin: [Session.get('currentBoard'), Meteor.user().profile.templatesBoardId]}, + _id: {$nin: [Session.get('currentBoard'), (Meteor.user().profile || {}).templatesBoardId]}, }); } if (!board) { @@ -510,7 +510,7 @@ BlazeComponent.extendComponent({ this.swimlaneId = ''; // Swimlane where to insert card const swimlane = $(Popup._getTopStack().openerElement).parents('.js-swimlane'); - if (Meteor.user().profile.boardView === 'board-view-swimlanes') + if ((Meteor.user().profile || {}).boardView === 'board-view-swimlanes') this.swimlaneId = Blaze.getData(swimlane[0])._id; else this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id; @@ -620,7 +620,7 @@ BlazeComponent.extendComponent({ this.listId = this.parentComponent().data()._id; this.swimlaneId = ''; - const boardView = Meteor.user().profile.boardView; + const boardView = (Meteor.user().profile || {}).boardView; if (boardView === 'board-view-swimlanes') this.swimlaneId = this.parentComponent().parentComponent().parentComponent().data()._id; }, diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index 25e6cb69..923d6063 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -30,7 +30,7 @@ BlazeComponent.extendComponent({ cardsCount() { const list = Template.currentData(); let swimlaneId = ''; - const boardView = Meteor.user().profile.boardView; + const boardView = (Meteor.user().profile || {}).boardView; if (boardView === 'board-view-swimlanes') swimlaneId = this.parentComponent().parentComponent().data()._id; -- cgit v1.2.3-1-g7c22