diff --git a/ui (gen4)/features/collections.js b/ui (gen4)/features/collections.js index f278bf25..628b713b 100755 --- a/ui (gen4)/features/collections.js +++ b/ui (gen4)/features/collections.js @@ -1982,7 +1982,9 @@ module.CollectionTags = core.ImageGridFeatures.Feature({ // load local_tags... local_tag_names .forEach(function(tag){ - tags[tag] = new Set(local_tags[tag] || []) + tags[tag] = new Set(local_tags[tag] + || (that.data.tags.__index || {})[tag] + || []) }) ;(this.crop_stack || []) @@ -2109,13 +2111,14 @@ module.CollectionTags = core.ImageGridFeatures.Feature({ } var t = (c.data || {}).tags || {} + /* XXX do we need this??? c.local_tags = c.local_tags || {} ;(that.config['collection-local-tags'] || []) .forEach(function(tag){ c.local_tags[tag] = new Set(c.local_tags[tag] || t[tag] || []) }) + //*/ }) }], - //*/ ], }) diff --git a/ui (gen4)/imagegrid/data.js b/ui (gen4)/imagegrid/data.js index 4458fa26..cff00feb 100755 --- a/ui (gen4)/imagegrid/data.js +++ b/ui (gen4)/imagegrid/data.js @@ -3399,6 +3399,8 @@ var DataWithTags2Prototype = { }, join: function(...others){ var res = DataWithTags2Prototype.__proto__.join.apply(this, arguments) + !(others[0] instanceof Data) + && others.shift() res.tags.join(...others .map(function(other){ return other.tags })) diff --git a/ui (gen4)/imagegrid/tags.js b/ui (gen4)/imagegrid/tags.js index daa7af5e..3db2db25 100755 --- a/ui (gen4)/imagegrid/tags.js +++ b/ui (gen4)/imagegrid/tags.js @@ -445,7 +445,7 @@ var TagsPrototype = { return false }, has: function(value){ - for(var v of Object.values(this.__index)){ + for(var v of Object.values(this.__index || {})){ if(v.has(value)){ return true } @@ -754,19 +754,22 @@ var TagsPrototype = { join: function(...others){ var that = this - var index = this.__index + var index = this.__index || {} others .forEach(function(other){ - Object.entries(other.__index) + Object.entries(other.__index || {}) .forEach(function(e){ index[e[0]] = new Set([...(index[e[0]] || []), ...e[1]]) }) }) + Object.keys(index).length > 0 + && this.__index == null + && (this.__index = index) return this }, // XXX create a new tagset with only the given values... // XXX this should support a function... filter: function(values){ var res = this.clone() - Object.values(res.__index) + Object.values(res.__index || {}) .forEach(function(s){ values.forEach(function(v){ s.delete(v) }) }) return res