Fix Message.findMessages() if private tag passed in, fix QWK export
This commit is contained in:
parent
72b6c5ded3
commit
fbec46d1b9
|
@ -288,7 +288,7 @@ 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
|
||||
- areaTags filter ignored
|
||||
- if NOT present, private areas are skipped
|
||||
|
||||
*=NYI
|
||||
|
@ -364,21 +364,24 @@ module.exports = class Message {
|
|||
)`);
|
||||
} else {
|
||||
if(filter.areaTag && filter.areaTag.length > 0) {
|
||||
if(Array.isArray(filter.areaTag)) {
|
||||
if (!Array.isArray(filter.areaTag)) {
|
||||
filter.areaTag = [ filter.areaTag ];
|
||||
}
|
||||
|
||||
const areaList = filter.areaTag
|
||||
.filter(t => t != Message.WellKnownAreaTags.Private)
|
||||
.filter(t => t !== Message.WellKnownAreaTags.Private)
|
||||
.map(t => `"${t}"`).join(', ');
|
||||
if(areaList.length > 0) {
|
||||
appendWhereClause(`m.area_tag IN(${areaList})`);
|
||||
} else {
|
||||
// nothing to do; no areas remain
|
||||
return cb(null, []);
|
||||
}
|
||||
} else if(_.isString(filter.areaTag) && Message.WellKnownAreaTags.Private !== filter.areaTag) {
|
||||
appendWhereClause(`m.area_tag = "${filter.areaTag}"`);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// explicit exclude of Private
|
||||
appendWhereClause(`m.area_tag != "${Message.WellKnownAreaTags.Private}"`, 'AND');
|
||||
}
|
||||
}
|
||||
|
||||
if(_.isNumber(filter.replyToMessageId)) {
|
||||
appendWhereClause(`m.reply_to_message_id=${filter.replyToMessageId}`);
|
||||
|
|
|
@ -270,7 +270,10 @@ exports.getModule = class MessageBaseQWKExport extends MenuModule {
|
|||
},
|
||||
(callback) => {
|
||||
// For each public area -> for each message
|
||||
const userExportAreas = this._getUserQWKExportAreas();
|
||||
const userExportAreas = this._getUserQWKExportAreas()
|
||||
.filter(exportArea => {
|
||||
return exportArea.areaTag !== Message.WellKnownAreaTags.Private;
|
||||
});
|
||||
async.eachSeries(userExportAreas, (exportArea, nextExportArea) => {
|
||||
const area = getMessageAreaByTag(exportArea.areaTag);
|
||||
if (!area) {
|
||||
|
|
Loading…
Reference in New Issue