* Add getAvailableFileAreaTags()

* Properly check area tags for system internal
This commit is contained in:
Bryan Ashby 2017-09-26 10:40:30 -06:00
parent f105c25e17
commit 59da1a2461
1 changed files with 7 additions and 1 deletions

View File

@ -28,6 +28,7 @@ const moment = require('moment');
exports.isInternalArea = isInternalArea;
exports.getAvailableFileAreas = getAvailableFileAreas;
exports.getAvailableFileAreaTags = getAvailableFileAreaTags;
exports.getSortedAvailableFileAreas = getSortedAvailableFileAreas;
exports.isValidStorageTag = isValidStorageTag;
exports.getAreaStorageDirectoryByTag = getAreaStorageDirectoryByTag;
@ -48,10 +49,11 @@ exports.updateAreaStatsScheduledEvent = updateAreaStatsScheduledEvent;
const WellKnownAreaTags = exports.WellKnownAreaTags = {
Invalid : '',
MessageAreaAttach : 'system_message_attachment',
TempDownloads : 'system_temporary_download',
};
function isInternalArea(areaTag) {
return areaTag === WellKnownAreaTags.MessageAreaAttach;
return [ WellKnownAreaTags.MessageAreaAttach, WellKnownAreaTags.TempDownloads ].includes(areaTag);
}
function getAvailableFileAreas(client, options) {
@ -77,6 +79,10 @@ function getAvailableFileAreas(client, options) {
});
}
function getAvailableFileAreaTags(client, options) {
return _.map(getAvailableFileAreas(client, options), area => area.areaTag);
}
function getSortedAvailableFileAreas(client, options) {
const areas = _.map(getAvailableFileAreas(client, options), v => v);
sortAreasOrConfs(areas);