Prevent private mail in message search results

This commit is contained in:
Bryan Ashby 2018-01-31 23:01:42 -07:00
parent 837326e15a
commit 5c580c1ecd
1 changed files with 13 additions and 5 deletions

View File

@ -228,7 +228,8 @@ module.exports = class Message {
filter.extraFields = []
filter.privateTagUserId = <userId> - if set, only private messages belonging to <userId> are processed
(any other areaTag or confTag filters will be ignored)
- any other areaTag or confTag filters will be ignored
- if NOT present, private areas are skipped
*=NYI
*/
@ -303,12 +304,19 @@ module.exports = class Message {
} else {
if(filter.areaTag && filter.areaTag.length > 0) {
if(Array.isArray(filter.areaTag)) {
const areaList = filter.areaTag.map(t => `"${t}"`).join(', ');
const areaList = filter.areaTag
.filter(t => t != Message.WellKnownAreaTags.Private)
.map(t => `"${t}"`).join(', ');
if(areaList.length > 0) {
appendWhereClause(`m.area_tag IN(${areaList})`);
} else if(_.isString(filter.areaTag)) {
}
} else if(_.isString(filter.areaTag) && Message.WellKnownAreaTags.Private !== filter.areaTag) {
appendWhereClause(`m.area_tag = "${filter.areaTag}"`);
}
}
// explicit exclude of Private
appendWhereClause(`m.area_tag != "${Message.WellKnownAreaTags.Private}"`);
}
if(_.isNumber(filter.replyToMessageId)) {