Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Break stream_data's dep on stream_color.

Steve Howelld9e4c2285c77
diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js
index a12a314cd77..5551488237a 100644
--- a/frontend_tests/node_tests/stream_data.js
+++ b/frontend_tests/node_tests/stream_data.js
@@ -12,7 +12,6 @@ const {page_params} = require("../zjsunit/zpage_params");
const color_data = zrequire("color_data");
const stream_topic_history = zrequire("stream_topic_history");
const people = zrequire("people");
-const stream_color = zrequire("stream_color");
const stream_data = zrequire("stream_data");
const message_list = zrequire("message_list");
const settings_config = zrequire("settings_config");
@@ -96,7 +95,7 @@ test("basics", () => {
assert(!stream_data.get_invite_only("unknown"));
assert.equal(stream_data.get_color("social"), "red");
- assert.equal(stream_data.get_color("unknown"), stream_color.default_color);
+ assert.equal(stream_data.get_color("unknown"), "#c2c2c2");
assert.equal(stream_data.get_name("denMARK"), "Denmark");
assert.equal(stream_data.get_name("unknown Stream"), "unknown Stream");
diff --git a/static/js/stream_color.js b/static/js/stream_color.js
index 2b943b81134..0d3dafc6340 100644
--- a/static/js/stream_color.js
+++ b/static/js/stream_color.js
@@ -5,8 +5,6 @@ import {i18n} from "./i18n";
import * as message_view_header from "./message_view_header";
import * as subs from "./subs";
-export const default_color = "#c2c2c2";
-
function update_table_stream_color(table, stream_name, color) {
// This is ugly, but temporary, as the new design will make it
// so that we only have color in the headers.
diff --git a/static/js/stream_data.js b/static/js/stream_data.js
index 60a62a08e9f..815fe844d10 100644
--- a/static/js/stream_data.js
+++ b/static/js/stream_data.js
@@ -8,10 +8,11 @@ import {page_params} from "./page_params";
import * as peer_data from "./peer_data";
import * as people from "./people";
import * as settings_config from "./settings_config";
-import * as stream_color from "./stream_color";
import * as stream_topic_history from "./stream_topic_history";
import * as util from "./util";
+const DEFAULT_COLOR = "#c2c2c2";
+
// Expose get_subscriber_count for our automated puppeteer tests.
export const get_subscriber_count = peer_data.get_subscriber_count;
@@ -544,7 +545,7 @@ export function canonicalized_name(stream_name) {
export function get_color(stream_name) {
const sub = get_sub(stream_name);
if (sub === undefined) {
- return stream_color.default_color;
+ return DEFAULT_COLOR;
}
return sub.color;
}