mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
refactor: Pass only stream id, not name, to compose_actions.start().
As part of the process of moving from stream names to ids, we now only pass the stream id in compose args to `compose_actions.start()`. For when we still need the stream name, and have access to the compose args, we compute it from the id exactly where needed, to localise the instances of stream names.
This commit is contained in:
@@ -198,11 +198,9 @@ export function restore_message(draft) {
|
||||
let compose_args;
|
||||
|
||||
if (draft.type === "stream") {
|
||||
const stream_name = stream_data.get_stream_name_from_id(draft.stream_id);
|
||||
compose_args = {
|
||||
type: "stream",
|
||||
stream_id: draft.stream_id,
|
||||
stream_name,
|
||||
topic: draft.topic,
|
||||
content: draft.content,
|
||||
};
|
||||
|
||||
@@ -29,7 +29,10 @@ function restore_draft(draft_id) {
|
||||
if (draft.stream_id !== undefined && draft.topic !== "") {
|
||||
narrow.activate(
|
||||
[
|
||||
{operator: "stream", operand: compose_args.stream_name},
|
||||
{
|
||||
operator: "stream",
|
||||
operand: stream_data.get_stream_name_from_id(compose_args.stream_id),
|
||||
},
|
||||
{operator: "topic", operand: compose_args.topic},
|
||||
],
|
||||
{trigger: "restore draft"},
|
||||
|
||||
@@ -21,7 +21,10 @@ function narrow_via_edit_scheduled_message(compose_args) {
|
||||
if (compose_args.type === "stream") {
|
||||
narrow.activate(
|
||||
[
|
||||
{operator: "stream", operand: compose_args.stream},
|
||||
{
|
||||
operator: "stream",
|
||||
operand: stream_data.get_stream_name_from_id(compose_args.stream_id),
|
||||
},
|
||||
{operator: "topic", operand: compose_args.topic},
|
||||
],
|
||||
{trigger: "edit scheduled message"},
|
||||
@@ -39,7 +42,6 @@ export function open_scheduled_message_in_compose(scheduled_msg, should_narrow_t
|
||||
compose_args = {
|
||||
type: "stream",
|
||||
stream_id: scheduled_msg.to,
|
||||
stream: stream_data.get_stream_name_from_id(scheduled_msg.to),
|
||||
topic: scheduled_msg.topic,
|
||||
content: scheduled_msg.content,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user