mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
Change how the tutorial overrides the default stream color.
The tutorial introduces "engineering" messages that might not be in the user's normal subscription, and they would get a gray border if we did not override the stream color. Before this change, we accomplished this by overriding the core data structure in stream_data.js. Now we are a bit more future-proof; we only override stream_color.default_color. (imported from commit 0d0845b72f766912679f5aa7641ae9a60fdbb4ce)
This commit is contained in:
@@ -25,14 +25,6 @@ exports.delete_sub = function (stream_name) {
|
|||||||
stream_info.del(stream_name);
|
stream_info.del(stream_name);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.set_stream_info = function (new_stream_info) {
|
|
||||||
stream_info = new_stream_info;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.get_stream_info = function () {
|
|
||||||
return stream_info;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.subscribed_subs = function () {
|
exports.subscribed_subs = function () {
|
||||||
return _.where(stream_info.values(), {subscribed: true});
|
return _.where(stream_info.values(), {subscribed: true});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ var current_popover_info;
|
|||||||
|
|
||||||
// We'll temporarily set stream colors for the streams we use in the demo
|
// We'll temporarily set stream colors for the streams we use in the demo
|
||||||
// tutorial messages.
|
// tutorial messages.
|
||||||
var real_stream_info;
|
var real_default_color;
|
||||||
var tutorial_stream_info = Dict.from({"engineering": {"color": "#76ce90"}});
|
var tutorial_default_color = '#76ce90';
|
||||||
|
|
||||||
// Each message object contains the minimal information necessary for it to be
|
// Each message object contains the minimal information necessary for it to be
|
||||||
// processed by our system for adding messages to your feed.
|
// processed by our system for adding messages to your feed.
|
||||||
@@ -333,7 +333,7 @@ function finale() {
|
|||||||
current_msg_list.clear();
|
current_msg_list.clear();
|
||||||
// Force a check on new events before we re-render the message list.
|
// Force a check on new events before we re-render the message list.
|
||||||
server_events.force_get_events();
|
server_events.force_get_events();
|
||||||
stream_data.set_stream_info(real_stream_info);
|
stream_color.default_color = real_default_color;
|
||||||
util.show_first_run_message();
|
util.show_first_run_message();
|
||||||
current_msg_list.rerender();
|
current_msg_list.rerender();
|
||||||
enable_event_handlers();
|
enable_event_handlers();
|
||||||
@@ -513,8 +513,8 @@ exports.start = function () {
|
|||||||
narrow.deactivate();
|
narrow.deactivate();
|
||||||
|
|
||||||
// Set temporarly colors for the streams used in the tutorial.
|
// Set temporarly colors for the streams used in the tutorial.
|
||||||
real_stream_info = stream_data.get_stream_info();
|
real_default_color = stream_color.default_color;
|
||||||
stream_data.set_stream_info(tutorial_stream_info);
|
stream_color.default_color = tutorial_default_color;
|
||||||
// Add the fake messages to the feed and get started.
|
// Add the fake messages to the feed and get started.
|
||||||
current_msg_list.add_and_rerender(fake_messages);
|
current_msg_list.add_and_rerender(fake_messages);
|
||||||
disable_event_handlers();
|
disable_event_handlers();
|
||||||
|
|||||||
@@ -54,17 +54,6 @@ var stream_data = require('js/stream_data.js');
|
|||||||
assert(!stream_data.is_subscribed('social'));
|
assert(!stream_data.is_subscribed('social'));
|
||||||
}());
|
}());
|
||||||
|
|
||||||
(function test_get_and_set() {
|
|
||||||
stream_data.clear_subscriptions();
|
|
||||||
stream_data.add_sub('Denmark', {name: 'Denmark', subscribed: true});
|
|
||||||
assert.deepEqual(stream_data.subscribed_streams(), ['Denmark']);
|
|
||||||
var info = stream_data.get_stream_info();
|
|
||||||
stream_data.clear_subscriptions();
|
|
||||||
assert.deepEqual(stream_data.subscribed_streams(), []);
|
|
||||||
stream_data.set_stream_info(info);
|
|
||||||
assert.deepEqual(stream_data.subscribed_streams(), ['Denmark']);
|
|
||||||
}());
|
|
||||||
|
|
||||||
(function test_subscribers() {
|
(function test_subscribers() {
|
||||||
stream_data.clear_subscriptions();
|
stream_data.clear_subscriptions();
|
||||||
var sub = {name: 'Rome', subscribed: true};
|
var sub = {name: 'Rome', subscribed: true};
|
||||||
|
|||||||
Reference in New Issue
Block a user