mirror of
https://github.com/wekan/wekan.git
synced 2026-01-25 18:56:10 +01:00
Fix missing profile checks
This commit is contained in:
parent
97ff2bd2fa
commit
daf314b037
12 changed files with 39 additions and 35 deletions
|
|
@ -30,6 +30,8 @@ template(name="boardBody")
|
|||
+listsGroup(currentBoard)
|
||||
else if isViewCalendar
|
||||
+calendarView
|
||||
else
|
||||
+listsGroup(currentBoard)
|
||||
|
||||
template(name="calendarView")
|
||||
if isViewCalendar
|
||||
|
|
|
|||
|
|
@ -191,19 +191,19 @@ BlazeComponent.extendComponent({
|
|||
isViewSwimlanes() {
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return false;
|
||||
return (currentUser.profile.boardView === 'board-view-swimlanes');
|
||||
return ((currentUser.profile || {}).boardView === 'board-view-swimlanes');
|
||||
},
|
||||
|
||||
isViewLists() {
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return true;
|
||||
return (currentUser.profile.boardView === 'board-view-lists');
|
||||
return ((currentUser.profile || {}).boardView === 'board-view-lists');
|
||||
},
|
||||
|
||||
isViewCalendar() {
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return false;
|
||||
return (currentUser.profile.boardView === 'board-view-cal');
|
||||
return ((currentUser.profile || {}).boardView === 'board-view-cal');
|
||||
},
|
||||
|
||||
openNewListForm() {
|
||||
|
|
@ -335,6 +335,6 @@ BlazeComponent.extendComponent({
|
|||
isViewCalendar() {
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return false;
|
||||
return (currentUser.profile.boardView === 'board-view-cal');
|
||||
return ((currentUser.profile || {}).boardView === 'board-view-cal');
|
||||
},
|
||||
}).register('calendarView');
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ template(name="boardHeaderBar")
|
|||
a.board-header-btn.js-toggle-board-view(
|
||||
title="{{_ 'board-view'}}")
|
||||
i.fa.fa-th-large
|
||||
span {{_ currentUser.profile.boardView}}
|
||||
span {{#if currentUser.profile.boardView}}{{_ currentUser.profile.boardView}}{{else}}{{_ 'board-view-lists'}}{{/if}}
|
||||
|
||||
if canModifyBoard
|
||||
a.board-header-btn.js-multiselection-activate(
|
||||
|
|
|
|||
|
|
@ -89,12 +89,14 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
'click .js-toggle-board-view'() {
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser.profile.boardView === 'board-view-swimlanes') {
|
||||
if ((currentUser.profile || {}).boardView === 'board-view-swimlanes') {
|
||||
currentUser.setBoardView('board-view-cal');
|
||||
} else if (currentUser.profile.boardView === 'board-view-lists') {
|
||||
} else if ((currentUser.profile || {}).boardView === 'board-view-lists') {
|
||||
currentUser.setBoardView('board-view-swimlanes');
|
||||
} else if (currentUser.profile.boardView === 'board-view-cal') {
|
||||
} else if ((currentUser.profile || {}).boardView === 'board-view-cal') {
|
||||
currentUser.setBoardView('board-view-lists');
|
||||
} else {
|
||||
currentUser.setBoardView('board-view-swimlanes');
|
||||
}
|
||||
},
|
||||
'click .js-toggle-sidebar'() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function currentListIsInThisSwimlane(swimlaneId) {
|
|||
function currentCardIsInThisList(listId, swimlaneId) {
|
||||
const currentCard = Cards.findOne(Session.get('currentCard'));
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser && currentUser.profile.boardView === 'board-view-swimlanes')
|
||||
if (currentUser && currentUser.profile && currentUser.profile.boardView === 'board-view-swimlanes')
|
||||
return currentCard && currentCard.listId === listId && currentCard.swimlaneId === swimlaneId;
|
||||
else // Default view: board-view-lists
|
||||
return currentCard && currentCard.listId === listId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue