This commit is contained in:
Wyatt Johnson
2018-09-13 11:10:45 -06:00
parent c19d4a433a
commit 71b8bb5d60
+8 -3
View File
@@ -5,7 +5,6 @@ const Assets = require('./assets');
const Settings = require('./settings');
const { ADD_COMMENT_TAG } = require('../perms/constants');
const { ErrNotAuthorized } = require('../errors');
const { get, has } = require('lodash');
const updateModel = async (item_type, query, update) => {
// Get the model to update with.
@@ -60,8 +59,14 @@ class TagsService {
asset = await Assets.findById(id);
}
if (asset && has(asset, 'settings.tags')) {
return get(asset, 'settings.tags');
// FIXME: comments ...
if (
asset &&
asset.settings &&
asset.settings.tags &&
Array.isArray(asset.settings.tags)
) {
return asset.settings.tags;
}
// Extract the tags from the settings object.