Optionally draw a lock icon by the stream name in the main view.

If it's an invite-only stream.

(imported from commit 02bb80fee6df2cd32ded0c6f2c2b918b8aa8ac05)
This commit is contained in:
Waseem Daher 2013-02-05 14:51:11 -05:00
parent f20bd27cf9
commit 4da5c83f64
3 changed files with 10 additions and 0 deletions

View File

@ -25,6 +25,7 @@
class="message_header message_header_stream left_part" style="background-color: {{background_color}};"> class="message_header message_header_stream left_part" style="background-color: {{background_color}};">
</td> </td>
<td class="message_header message_header_stream right_part" style="background-color: {{background_color}};"> <td class="message_header message_header_stream right_part" style="background-color: {{background_color}};">
{{#if invite_only}}<i class="icon-lock" title="This is an invite-only stream"></i>{{/if}}
<span class="message_label_clickable narrows_by_recipient stream_label" <span class="message_label_clickable narrows_by_recipient stream_label"
title="Narrow to stream &quot;{{display_recipient}}&quot;">{{display_recipient}}</span> title="Narrow to stream &quot;{{display_recipient}}&quot;">{{display_recipient}}</span>
&nbsp; | &nbsp; &nbsp; | &nbsp;

View File

@ -203,6 +203,14 @@ exports.get_color = function (stream_name) {
return stream_info[lstream_name].color; return stream_info[lstream_name].color;
}; };
exports.get_invite_only = function (stream_name) {
var lstream_name = stream_name.toLowerCase();
if (stream_info[lstream_name] === undefined) {
return false;
}
return stream_info[lstream_name].invite_only;
};
function get_disjoint_list(list1, list2) { function get_disjoint_list(list1, list2) {
return $.grep(list1, function (elt) { return $.grep(list1, function (elt) {
return $.inArray(elt, list2) === -1; return $.inArray(elt, list2) === -1;

View File

@ -343,6 +343,7 @@ function add_to_table(messages, table_name, filter_function, where, allow_collap
if (message.is_stream) { if (message.is_stream) {
message.background_color = subs.get_color(message.display_recipient); message.background_color = subs.get_color(message.display_recipient);
message.invite_only = subs.get_invite_only(message.display_recipient);
} }
messages_to_render.push(message); messages_to_render.push(message);