summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-11-19 14:09:36 +0200
committerLauri Ojansivu <x@xet7.org>2019-11-19 14:09:36 +0200
commit351d4767d7e93c90ac798769d6071da8730d834f (patch)
tree47b9e49342f17affce947c840566b9c03a630aab /models/users.js
parentf595120e7203fdeee1a6c899adb948807e84b672 (diff)
downloadwekan-351d4767d7e93c90ac798769d6071da8730d834f.tar.gz
wekan-351d4767d7e93c90ac798769d6071da8730d834f.tar.bz2
wekan-351d4767d7e93c90ac798769d6071da8730d834f.zip
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 !
Diffstat (limited to 'models/users.js')
-rw-r--r--models/users.js71
1 files changed, 53 insertions, 18 deletions
diff --git a/models/users.js b/models/users.js
index 08b10eb5..83a224ba 100644
--- a/models/users.js
+++ b/models/users.js
@@ -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);