From 575c2335975cc6cc960d2061ba8fdfa726ed8618 Mon Sep 17 00:00:00 2001 From: Cameron Fischer Date: Sat, 18 Sep 2021 11:47:46 -0400 Subject: [PATCH] Update untagged filter to avoid $tw.utils.pushTop (#6034) --- core/modules/filters/untagged.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/core/modules/filters/untagged.js b/core/modules/filters/untagged.js index 5a08b4edc..c1aca52c7 100644 --- a/core/modules/filters/untagged.js +++ b/core/modules/filters/untagged.js @@ -16,20 +16,13 @@ Filter operator returning all the selected tiddlers that are untagged Export our filter function */ exports.untagged = function(source,operator,options) { - var results = []; - if(operator.prefix === "!") { - source(function(tiddler,title) { - if(tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) { - $tw.utils.pushTop(results,title); - } - }); - } else { - source(function(tiddler,title) { - if(!tiddler || !tiddler.hasField("tags") || ($tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length === 0)) { - $tw.utils.pushTop(results,title); - } - }); - } + var results = [], + expected = (operator.prefix === "!"); + source(function(tiddler,title) { + if((tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) === expected) { + results.push(title); + } + }); return results; };