When logged in, use database for setting, so that changes are

immediate. Only on public board use cookies.
Comment out Collapse CSS that is not in use.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2019-11-19 14:09:36 +02:00
parent f595120e72
commit 351d4767d7
12 changed files with 318 additions and 131 deletions

View file

@ -119,6 +119,13 @@ Users.attachSchema(
type: String,
optional: true,
},
'profile.showDesktopDragHandles': {
/**
* does the user want to hide system messages?
*/
type: Boolean,
optional: true,
},
'profile.hiddenSystemMessages': {
/**
* does the user want to hide system messages?
@ -126,6 +133,13 @@ Users.attachSchema(
type: Boolean,
optional: true,
},
'profile.hiddenMinicardLabelText': {
/**
* does the user want to hide minicard label texts?
*/
type: Boolean,
optional: true,
},
'profile.initials': {
/**
* initials of the user
@ -184,7 +198,6 @@ Users.attachSchema(
allowedValues: [
'board-view-lists',
'board-view-swimlanes',
'board-view-collapse',
'board-view-cal',
],
},
@ -382,18 +395,10 @@ Users.helpers({
}
return ret;
},
//hasSortBy() {
// if use doesn't have dragHandle, then we can let user to choose sort list by different order
//return this.hasShowDesktopDragHandles();
// return false;
/*
if (typeof currentUser === 'undefined' || typeof currentUser === 'null') {
return false;
} else {
return this.hasShowDesktopDragHandles();
}
*/
//},
hasSortBy() {
// if use doesn't have dragHandle, then we can let user to choose sort list by different order
return !this.hasShowDesktopDragHandles();
},
getListSortBy() {
return this._getListSortBy()[0];
},
@ -414,11 +419,21 @@ Users.helpers({
return _.contains(notifications, activityId);
},
hasShowDesktopDragHandles() {
const profile = this.profile || {};
return profile.showDesktopDragHandles || false;
},
hasHiddenSystemMessages() {
const profile = this.profile || {};
return profile.hiddenSystemMessages || false;
},
hasHiddenMinicardLabelText() {
const profile = this.profile || {};
return profile.hiddenMinicardLabelText || false;
},
getEmailBuffer() {
const { emailBuffer = [] } = this.profile || {};
return emailBuffer;
@ -440,11 +455,8 @@ Users.helpers({
},
getLimitToShowCardsCount() {
currentUser = Meteor.user();
if (currentUser) {
const profile = this.profile || {};
return profile.showCardsCountAt;
}
const profile = this.profile || {};
return profile.showCardsCountAt;
},
getName() {
@ -524,6 +536,13 @@ Users.mutations({
},
};
},
toggleDesktopHandles(value = false) {
return {
$set: {
'profile.showDesktopDragHandles': !value,
},
};
},
toggleSystem(value = false) {
return {
@ -533,6 +552,14 @@ Users.mutations({
};
},
toggleLabelText(value = false) {
return {
$set: {
'profile.hiddenMinicardLabelText': !value,
},
};
},
addNotification(activityId) {
return {
$addToSet: {
@ -597,10 +624,18 @@ Meteor.methods({
check(value, String);
Meteor.user().setListSortBy(value);
},
toggleDesktopDragHandles() {
const user = Meteor.user();
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());
},
toggleSystemMessages() {
const user = Meteor.user();
user.toggleSystem(user.hasHiddenSystemMessages());
},
toggleMinicardLabelText() {
const user = Meteor.user();
user.toggleLabelText(user.hasHiddenMinicardLabelText());
},
changeLimitToShowCardsCount(limit) {
check(limit, Number);
Meteor.user().setShowCardsCountAt(limit);