mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
compose_state: Break out stream_name() into separate getter and setter.
This code is equivalent, because the keep_leading_whitespace parameter of get_or_set was never used for the stream name. This addresses an open TODO and makes the code more readable.
This commit is contained in:
@@ -36,9 +36,18 @@ function get_or_set(fieldname, keep_leading_whitespace) {
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: Break out setters and getter into their own functions.
|
||||
export const stream_name = get_or_set("stream_message_recipient_stream");
|
||||
export function stream_name() {
|
||||
return $("#stream_message_recipient_stream").val().trim();
|
||||
}
|
||||
|
||||
export function set_stream_name(newval) {
|
||||
if (newval !== undefined) {
|
||||
const $elem = $("#stream_message_recipient_stream");
|
||||
$elem.val(newval);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Break out setter and getter into their own functions.
|
||||
export const topic = get_or_set("stream_message_recipient_topic");
|
||||
|
||||
// We can't trim leading whitespace in `compose_textarea` because
|
||||
|
||||
Reference in New Issue
Block a user