From 0b4669621a979423127a000550ec462c866b302b Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sun, 27 Nov 2016 14:51:51 +0000 Subject: [PATCH] Return all tiddlers when "is" filter operand is missing --- core/modules/filters/is.js | 17 +++++++++++++---- editions/tw5.com/tiddlers/filters/is.tid | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/core/modules/filters/is.js b/core/modules/filters/is.js index 0db243044..514443a62 100644 --- a/core/modules/filters/is.js +++ b/core/modules/filters/is.js @@ -28,11 +28,20 @@ Export our filter function exports.is = function(source,operator,options) { // Dispatch to the correct isfilteroperator var isFilterOperators = getIsFilterOperators(); - var isFilterOperator = isFilterOperators[operator.operand]; - if(isFilterOperator) { - return isFilterOperator(source,operator.prefix,options); + if(operator.operand) { + var isFilterOperator = isFilterOperators[operator.operand]; + if(isFilterOperator) { + return isFilterOperator(source,operator.prefix,options); + } else { + return [$tw.language.getString("Error/IsFilterOperator")]; + } } else { - return [$tw.language.getString("Error/IsFilterOperator")]; + // Return all tiddlers if the operand is missing + var results = []; + source(function(tiddler,title) { + results.push(title); + }); + return results; } }; diff --git a/editions/tw5.com/tiddlers/filters/is.tid b/editions/tw5.com/tiddlers/filters/is.tid index c274e3a86..113af22c8 100644 --- a/editions/tw5.com/tiddlers/filters/is.tid +++ b/editions/tw5.com/tiddlers/filters/is.tid @@ -1,5 +1,5 @@ created: 20140410103123179 -modified: 20150220161001000 +modified: 20161127142329969 tags: [[Filter Operators]] [[Common Operators]] [[Negatable Operators]] title: is Operator type: text/vnd.tiddlywiki @@ -23,7 +23,7 @@ The parameter <<.place C>> is one of the following fundamental categories: |^`tag` |is in use as a tag | |^`tiddler` |exists as a non-shadow tiddler | -If <<.place C>> is anything else, the output is an error message. +If <<.place C>> is anything else an error message is returned. <<.from-version "5.1.14"> if <<.place C>> is blank, the output is passed through unchanged (in earlier versions an error message was returned). `!is[tiddler]` is a synonym for `is[missing]`, and vice versa.