Deprecate stream_list.add_narrow_filter().

We now call add_stream_to_sidebar() instead.  The old function was
only ever called for streams, so the newly named function is more
descriptive of what it does.

(imported from commit 7ae373279ea9987d3637cdbdc427680ac989fe86)
This commit is contained in:
Steve Howell
2014-01-16 16:59:30 -05:00
parent 56dc4e0b8e
commit c7bf349e70

View File

@@ -139,20 +139,12 @@ function build_narrow_filter(name, type) {
return list_item;
}
// Adds the sidebar stream name that, when clicked,
// narrows to that stream
function add_narrow_filter(name, type) {
if (get_filter_li(type, name).length) {
exports.add_stream_to_sidebar = function (stream_name) {
if (exports.get_stream_li(stream_name).length) {
// already exists
return false;
}
return build_narrow_filter(name, type);
}
// This is a testing shim for now, but the goal is to replace
// add_narrow_filter() with this API.
exports.add_stream_to_sidebar = function (stream_name) {
return add_narrow_filter(stream_name, 'stream');
return build_narrow_filter(stream_name, 'stream');
};
exports.get_stream_li = function (stream_name) {
@@ -435,7 +427,7 @@ $(function () {
$(document).on('sub_obj_created.zulip', function (event) {
if (event.sub.subscribed) {
var stream_name = event.sub.name;
var li = add_narrow_filter(stream_name, "stream");
var li = exports.add_stream_to_sidebar(stream_name);
if (li) {
event.sub.sidebar_li = li;
}
@@ -444,7 +436,7 @@ $(function () {
$(document).on('subscription_add_done.zulip', function (event) {
var stream_name = event.sub.name;
var li = add_narrow_filter(stream_name, "stream");
var li = exports.add_stream_to_sidebar(stream_name);
if (li) {
event.sub.sidebar_li = li;
}