compose_state: Add is_topic_field_empty().

This is required for adding a narrow-to-recipient button which
we do not want to show when topic field is empty.
This commit is contained in:
Dinesh 2022-03-09 22:59:01 +05:30 committed by Tim Abbott
parent d363ea6158
commit 1c0368c402
2 changed files with 12 additions and 0 deletions

View File

@ -20,3 +20,11 @@ run_test("private_message_recipient", ({override}) => {
compose_state.private_message_recipient("fred@fred.org");
assert.equal(compose_state.private_message_recipient(), "fred@fred.org");
});
run_test("is_topic_field_empty", () => {
compose_state.topic("");
assert.equal(compose_state.is_topic_field_empty(), true);
compose_state.topic("foo");
assert.equal(compose_state.is_topic_field_empty(), false);
});

View File

@ -84,3 +84,7 @@ export function private_message_recipient(value) {
export function has_message_content() {
return message_content() !== "";
}
export function is_topic_field_empty() {
return topic() === "";
}