drafts: Rename stream to stream_name in formatted draft object.

We are renaming stream to stream_name in formatted draft object
just to be more explicit and be clear that we are storing that
stream name in this variable.
This commit is contained in:
sahil839 2020-10-25 00:54:21 +05:30 committed by Tim Abbott
parent 238ba1c36f
commit d74f6a5de6
3 changed files with 10 additions and 10 deletions

View File

@ -256,7 +256,7 @@ test("format_drafts", ({override, mock_template}) => {
{
draft_id: "id1",
is_stream: true,
stream: "stream",
stream_name: "stream",
stream_color: "#FFFFFF",
dark_background: "",
topic: "topic",
@ -287,7 +287,7 @@ test("format_drafts", ({override, mock_template}) => {
{
draft_id: "id3",
is_stream: true,
stream: "stream 2",
stream_name: "stream 2",
stream_color: "#FFFFFF",
dark_background: "",
topic: "topic",
@ -333,7 +333,7 @@ test("format_drafts", ({override, mock_template}) => {
return {name: "stream-rename"};
};
expected[0].stream = "stream-rename";
expected[0].stream_name = "stream-rename";
drafts.launch();
timerender.__Rewire__("render_now", stub_render_now);

View File

@ -246,17 +246,17 @@ export function format_draft(draft) {
// In case there is no stream for the draft, we need a
// single space char for proper rendering of the stream label
const space_string = new Handlebars.SafeString(" ");
let stream = draft.stream.length > 0 ? draft.stream : space_string;
let stream_name = draft.stream.length > 0 ? draft.stream : space_string;
if (draft.stream_id) {
const sub = sub_store.get(draft.stream_id);
if (sub && sub.name !== stream) {
stream = sub.name;
draft.stream = stream;
if (sub && sub.name !== stream_name) {
stream_name = sub.name;
draft.stream = stream_name;
draft_model.editDraft(id, draft);
}
}
let draft_topic = util.get_draft_topic(draft);
const draft_stream_color = stream_data.get_color(stream);
const draft_stream_color = stream_data.get_color(stream_name);
if (draft_topic === "") {
draft_topic = compose.empty_topic_placeholder();
@ -265,7 +265,7 @@ export function format_draft(draft) {
formatted = {
draft_id: draft.id,
is_stream: true,
stream,
stream_name,
stream_color: draft_stream_color,
dark_background: color_class.get_css_class(draft_stream_color),
topic: draft_topic,

View File

@ -5,7 +5,7 @@
<div class="message-header-contents">
<div class="message_label_clickable stream_label {{dark_background}}"
style="background: {{stream_color}}; border-left-color: {{stream_color}};">
{{stream}}
{{stream_name}}
</div>
<span class="stream_topic">