summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-05-09 14:32:38 +0300
committerLauri Ojansivu <x@xet7.org>2019-05-09 14:32:38 +0300
commit64ee60a008c929dcf63ac5d2c49f7f189508a757 (patch)
tree5a05b4ef4cc146eff7c710d64ef4c33e3b166b75 /models
parent434ed895eddb3836add1e23f0382cf0c5d3b9978 (diff)
downloadwekan-64ee60a008c929dcf63ac5d2c49f7f189508a757.tar.gz
wekan-64ee60a008c929dcf63ac5d2c49f7f189508a757.tar.bz2
wekan-64ee60a008c929dcf63ac5d2c49f7f189508a757.zip
Fix missing profile checks.
Thanks to justinr1234 !
Diffstat (limited to 'models')
-rw-r--r--models/export.js2
-rw-r--r--models/swimlanes.js6
-rw-r--r--models/users.js18
3 files changed, 13 insertions, 13 deletions
diff --git a/models/export.js b/models/export.js
index 49aac828..4f17d727 100644
--- a/models/export.js
+++ b/models/export.js
@@ -172,7 +172,7 @@ export class Exporter {
};
result.users = Users.find(byUserIds, userFields).fetch().map((user) => {
// user avatar is stored as a relative url, we export absolute
- if (user.profile.avatarUrl) {
+ if ((user.profile || {}).avatarUrl) {
user.profile.avatarUrl = FlowRouter.url(user.profile.avatarUrl);
}
return user;
diff --git a/models/swimlanes.js b/models/swimlanes.js
index bd2565af..9a53d116 100644
--- a/models/swimlanes.js
+++ b/models/swimlanes.js
@@ -168,17 +168,17 @@ Swimlanes.helpers({
isListTemplatesSwimlane() {
const user = Users.findOne(Meteor.userId());
- return user.profile.listTemplatesSwimlaneId === this._id;
+ return (user.profile || {}).listTemplatesSwimlaneId === this._id;
},
isCardTemplatesSwimlane() {
const user = Users.findOne(Meteor.userId());
- return user.profile.cardTemplatesSwimlaneId === this._id;
+ return (user.profile || {}).cardTemplatesSwimlaneId === this._id;
},
isBoardTemplatesSwimlane() {
const user = Users.findOne(Meteor.userId());
- return user.profile.boardTemplatesSwimlaneId === this._id;
+ return (user.profile || {}).boardTemplatesSwimlaneId === this._id;
},
remove() {
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;
},
});