mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
compose_ui: Fix incorrect ComposePlaceholderOptions type.
When opening compose without a stream prefilled from say the inbox view, stream_id will be undefined here.
This commit is contained in:
@@ -38,7 +38,7 @@ type ComposeTriggeredOptions = {
|
|||||||
type ComposePlaceholderOptions =
|
type ComposePlaceholderOptions =
|
||||||
| {
|
| {
|
||||||
message_type: "stream";
|
message_type: "stream";
|
||||||
stream_id: number;
|
stream_id: number | undefined;
|
||||||
topic: string;
|
topic: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@@ -294,8 +294,13 @@ export function compute_placeholder_text(opts: ComposePlaceholderOptions): strin
|
|||||||
// because the caller is expected to insert this into the
|
// because the caller is expected to insert this into the
|
||||||
// placeholder field in a way that does HTML escaping.
|
// placeholder field in a way that does HTML escaping.
|
||||||
if (opts.message_type === "stream") {
|
if (opts.message_type === "stream") {
|
||||||
const stream = stream_data.get_sub_by_id(opts.stream_id);
|
let stream_name = "";
|
||||||
const stream_name = stream ? stream.name : "";
|
if (opts.stream_id !== undefined) {
|
||||||
|
const stream = stream_data.get_sub_by_id(opts.stream_id);
|
||||||
|
if (stream !== undefined) {
|
||||||
|
stream_name = stream.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (stream_name && opts.topic) {
|
if (stream_name && opts.topic) {
|
||||||
return $t(
|
return $t(
|
||||||
|
|||||||
Reference in New Issue
Block a user