Use real stream ids in our stream-related UI widgets.

Before this change, we were using sequentially generated ids
on the client side to identify streams.  Now we just use
the ids from the server.  The goal here is to reduce the
confusion of having two different ids attached to a stream.
Also, not that it matters a ton, but this also means that
the browser basically has an immutable id for each stream
that is future-proof to reloads, multiple create_sub calls, etc.
It also a bit easier to grep for ".stream_id" than ".id".

(imported from commit 057f9e50dfee127edfe3facd52da93108241666a)
This commit is contained in:
Steve Howell
2014-02-07 10:55:54 -05:00
committed by Tim Abbott
parent 2fb70eb38c
commit bb0608b55a
6 changed files with 28 additions and 22 deletions

View File

@@ -74,7 +74,8 @@ function iterate_to_find(selector, name_to_find, context) {
// as well, we probably should consider moving them to a different file.
function get_filter_li(type, name) {
if (type === 'stream') {
return $("#stream_sidebar_" + subs.stream_id(name));
var sub = stream_data.get_sub(name);
return $("#stream_sidebar_" + sub.stream_id);
} else if (type === "private") {
if (name.indexOf(",") < 0) {
return $("li.user_sidebar_entry[data-email='" + name + "']");
@@ -126,11 +127,12 @@ exports.set_in_home_view = function (stream, in_home) {
};
function build_stream_sidebar_row(name) {
var sub = stream_data.get_sub(name);
var args = {name: name,
id: subs.stream_id(name),
id: sub.stream_id,
uri: narrow.by_stream_uri(name),
not_in_home_view: (stream_data.in_home_view(name) === false),
invite_only: stream_data.get_sub(name).invite_only,
invite_only: sub.invite_only,
color: stream_data.get_color(name)
};
args.dark_background = stream_color.get_color_class(args.color);