fix error on console when user logout (Part 1)

This commit is contained in:
Martin Filser 2023-03-22 22:13:31 +01:00
parent b0c94f7ff2
commit 38a32824ea
2 changed files with 10 additions and 16 deletions

View file

@ -151,8 +151,8 @@ BlazeComponent.extendComponent({
}
const currUser = ReactiveCache.getCurrentUser();
let orgIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.orgIdsUserBelongs() : '';
if (orgIdsUserBelongs && orgIdsUserBelongs != '') {
let orgIdsUserBelongs = currUser?.orgIdsUserBelongs() || '';
if (orgIdsUserBelongs) {
let orgsIds = orgIdsUserBelongs.split(',');
// for(let i = 0; i < orgsIds.length; i++){
// query.$and[2].$or.push({'orgs.orgId': orgsIds[i]});
@ -162,8 +162,8 @@ BlazeComponent.extendComponent({
query.$and[2].$or.push({ 'orgs.orgId': { $in: orgsIds } });
}
let teamIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.teamIdsUserBelongs() : '';
if (teamIdsUserBelongs && teamIdsUserBelongs != '') {
let teamIdsUserBelongs = currUser?.teamIdsUserBelongs() || '';
if (teamIdsUserBelongs) {
let teamsIds = teamIdsUserBelongs.split(',');
// for(let i = 0; i < teamsIds.length; i++){
// query.$or[2].$or.push({'teams.teamId': teamsIds[i]});

View file

@ -687,14 +687,11 @@ Users.helpers({
return '';
},
orgIdsUserBelongs() {
let ret = '';
if (this.orgs) {
return this.orgs
.map(function (org) {
return org.orgId;
})
.join(',');
ret = this.orgs.map(org => org.orgId).join(',');
}
return '';
return ret;
},
teamsUserBelongs() {
if (this.teams) {
@ -708,14 +705,11 @@ Users.helpers({
return '';
},
teamIdsUserBelongs() {
let ret = '';
if (this.teams) {
return this.teams
.map(function (team) {
return team.teamId;
})
.join(',');
ret = this.teams.map(team => team.teamId).join(',');
}
return '';
return ret;
},
boards() {
return Boards.userBoards(this._id, null, {}, { sort: { sort: 1 } });