From 8027a73ea559fc389adeca6350047dfac448cc5f Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 9 Sep 2019 21:44:03 -0600 Subject: [PATCH] Another message area check --- core/message_area.js | 9 ++++++++- core/user_login.js | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/message_area.js b/core/message_area.js index 7f4993ec..f06c21a4 100644 --- a/core/message_area.js +++ b/core/message_area.js @@ -404,8 +404,15 @@ function getMessageListForArea(client, areaTag, filter, cb) Object.assign(filter, { areaTag } ); } + if(client) { + const area = getMessageAreaByTag(areaTag); + if(!client.acs.hasMessageAreaRead(area)) { + return cb(null, []); + } + } + if(Message.isPrivateAreaTag(areaTag)) { - filter.privateTagUserId = client.user.userId; + filter.privateTagUserId = client ? client.user.userId : 'INVALID_USER_ID'; } return Message.findMessages(filter, cb); diff --git a/core/user_login.js b/core/user_login.js index 627fb5ae..6c5e6813 100644 --- a/core/user_login.js +++ b/core/user_login.js @@ -130,9 +130,11 @@ function userLogin(client, username, password, options, cb) { function postLoginPrep(client, cb) { const defaultMsgAreaTag = (confTag) => { - return getDefaultMessageAreaTagByConfTag(client, confTag) || + return ( + getDefaultMessageAreaTagByConfTag(client, confTag) || getDefaultMessageAreaTagByConfTag(client, getDefaultMessageConferenceTag(client)) || - ''; + '' + ); }; async.series(