search.js: Kill off get_object_parts()

(imported from commit fabfa6c3bf8cb0749ba1379882eda8cb9c8316ed)
This commit is contained in:
Steve Howell 2013-07-15 18:24:04 -04:00
parent ec7a5c0ea5
commit d216069e29
1 changed files with 3 additions and 32 deletions

View File

@ -80,35 +80,6 @@ function describe(operators) {
}).join(', '); }).join(', ');
} }
function get_object_parts(obj) {
// N.B. action is *not* escaped by the caller
switch (obj.action) {
case 'stream':
return {prefix: 'Narrow to stream', query: get_query(obj), suffix: ''};
case 'private_message':
return {prefix: 'Narrow to private messages with',
query: get_person(obj),
suffix: ''};
case 'sender':
return {prefix: 'Narrow to messages sent by',
query: get_person(obj),
suffix: ''};
case 'operators':
// HACK: This label needs to be distinct from the above, because of the
// way we identify action objects by their labels. Using two spaces
// after 'Narrow to' ensures this, and is invisible with standard HTML
// whitespace handling.
return {prefix: '',
query: describe(obj.operators),
suffix: ''};
}
return {prefix: 'Error', query: 'Error', suffix: 'Error'};
}
function get_label(obj) { function get_label(obj) {
switch (obj.action) { switch (obj.action) {
case 'stream': case 'stream':
@ -319,9 +290,9 @@ exports.initialize = function () {
return prefix + ' ' + stream; return prefix + ' ' + stream;
} }
var parts = get_object_parts(obj); var description = describe(obj.operators);
parts.query = Handlebars.Utils.escapeExpression(parts.query); description = Handlebars.Utils.escapeExpression(description);
return parts.prefix + " " + parts.query + " " + parts.suffix; return description;
}, },
matcher: function (item) { matcher: function (item) {
return true; return true;