summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-05-08 16:51:27 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-05-08 16:54:15 -0500
commitdaf314b0378efac13b5c58adf32ce7348ea29193 (patch)
treea0b810e68819a917cf2d5d131c409c7861bf1acc /models/users.js
parent97ff2bd2fae8d199ba6fd7e3c8ac390a92edfe3c (diff)
downloadwekan-daf314b0378efac13b5c58adf32ce7348ea29193.tar.gz
wekan-daf314b0378efac13b5c58adf32ce7348ea29193.tar.bz2
wekan-daf314b0378efac13b5c58adf32ce7348ea29193.zip
Fix missing profile checks
Diffstat (limited to 'models/users.js')
-rw-r--r--models/users.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/models/users.js b/models/users.js
index 0dd9c1d6..3240f8de 100644
--- a/models/users.js
+++ b/models/users.js
@@ -288,32 +288,32 @@ Users.helpers({
},
starredBoards() {
- const {starredBoards = []} = this.profile;
+ const {starredBoards = []} = this.profile || {};
return Boards.find({archived: false, _id: {$in: starredBoards}});
},
hasStarred(boardId) {
- const {starredBoards = []} = this.profile;
+ const {starredBoards = []} = this.profile || {};
return _.contains(starredBoards, boardId);
},
invitedBoards() {
- const {invitedBoards = []} = this.profile;
+ const {invitedBoards = []} = this.profile || {};
return Boards.find({archived: false, _id: {$in: invitedBoards}});
},
isInvitedTo(boardId) {
- const {invitedBoards = []} = this.profile;
+ const {invitedBoards = []} = this.profile || {};
return _.contains(invitedBoards, boardId);
},
hasTag(tag) {
- const {tags = []} = this.profile;
+ const {tags = []} = this.profile || {};
return _.contains(tags, tag);
},
hasNotification(activityId) {
- const {notifications = []} = this.profile;
+ const {notifications = []} = this.profile || {};
return _.contains(notifications, activityId);
},
@@ -323,7 +323,7 @@ Users.helpers({
},
getEmailBuffer() {
- const {emailBuffer = []} = this.profile;
+ const {emailBuffer = []} = this.profile || {};
return emailBuffer;
},
@@ -358,11 +358,11 @@ Users.helpers({
},
getTemplatesBoardId() {
- return this.profile.templatesBoardId;
+ return (this.profile || {}).templatesBoardId;
},
getTemplatesBoardSlug() {
- return Boards.findOne(this.profile.templatesBoardId).slug;
+ return (Boards.findOne((this.profile || {}).templatesBoardId) || {}).slug;
},
});