Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Rename placeholder update function for clarity.

Karl Stolleycae48d3faac8
diff --git a/web/src/compose_actions.ts b/web/src/compose_actions.ts
index 61446f7c142..24e47384f31 100644
--- a/web/src/compose_actions.ts
+++ b/web/src/compose_actions.ts
@@ -193,7 +193,7 @@ export let complete_starting_tasks = (opts: ComposeActionsOpts): void => {
maybe_scroll_up_selected_message(opts);
compose_fade.start_compose(opts.message_type);
$(document).trigger(new $.Event("compose_started.zulip", opts));
- compose_recipient.update_placeholder_text();
+ compose_recipient.update_compose_area_placeholder_text();
compose_recipient.update_narrow_to_recipient_visibility();
// We explicitly call this function here apart from compose_setup.js
// as this helps to show banner when responding in an interleaved view.
diff --git a/web/src/compose_recipient.ts b/web/src/compose_recipient.ts
index 90b602cc8eb..b8cc0cc8773 100644
--- a/web/src/compose_recipient.ts
+++ b/web/src/compose_recipient.ts
@@ -175,7 +175,7 @@ function switch_message_type(message_type: MessageType): void {
private_message_recipient: compose_state.private_message_recipient(),
};
update_compose_for_message_type(opts);
- update_placeholder_text();
+ update_compose_area_placeholder_text();
compose_ui.set_focus(opts);
}
@@ -348,7 +348,7 @@ export function initialize(): void {
$("#private_message_recipient").on("input", restore_placeholder_in_firefox_for_no_input);
}
-export let update_placeholder_text = (): void => {
+export let update_compose_area_placeholder_text = (): void => {
const $textarea: JQuery<HTMLTextAreaElement> = $("textarea#compose-textarea");
// Change compose placeholder text only if compose box is open.
if (!$textarea.is(":visible")) {
@@ -375,8 +375,10 @@ export let update_placeholder_text = (): void => {
compose_ui.autosize_textarea($textarea);
};
-export function rewire_update_placeholder_text(value: typeof update_placeholder_text): void {
- update_placeholder_text = value;
+export function rewire_update_compose_area_placeholder_text(
+ value: typeof update_compose_area_placeholder_text,
+): void {
+ update_compose_area_placeholder_text = value;
}
// This function addresses the issue of the placeholder not reappearing in Firefox
diff --git a/web/src/compose_setup.js b/web/src/compose_setup.js
index f5af56bd19b..37eed0c0cb9 100644
--- a/web/src/compose_setup.js
+++ b/web/src/compose_setup.js
@@ -582,7 +582,7 @@ export function initialize() {
});
$("textarea#compose-textarea").on("focus", () => {
- compose_recipient.update_placeholder_text();
+ compose_recipient.update_compose_area_placeholder_text();
if (narrow_state.narrowed_by_reply()) {
compose_notifications.maybe_show_one_time_non_interleaved_view_messages_fading_banner();
} else {
@@ -604,11 +604,11 @@ export function initialize() {
});
$("input#stream_message_recipient_topic").on("focus", () => {
- compose_recipient.update_placeholder_text();
+ compose_recipient.update_compose_area_placeholder_text();
});
$("input#stream_message_recipient_topic").on("input", () => {
- compose_recipient.update_placeholder_text();
+ compose_recipient.update_compose_area_placeholder_text();
});
$("body").on("click", ".formatting_button", function (e) {
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js
index b0585cf8031..225eaa6664e 100644
--- a/web/src/server_events_dispatch.js
+++ b/web/src/server_events_dispatch.js
@@ -1056,7 +1056,7 @@ export function dispatch_normal_event(event) {
// Update the status text in compose box placeholder when opened to self.
if (compose_pm_pill.get_user_ids().includes(event.user_id)) {
- compose_recipient.update_placeholder_text();
+ compose_recipient.update_compose_area_placeholder_text();
}
}
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index 28cd89513f1..4c7218beac1 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -569,7 +569,7 @@ export function initialize_everything(state_data) {
compose_recipient.initialize();
compose_pm_pill.initialize({
on_pill_create_or_remove() {
- compose_recipient.update_placeholder_text();
+ compose_recipient.update_compose_area_placeholder_text();
compose_recipient.check_posting_policy_for_compose_box();
},
});
diff --git a/web/tests/compose.test.cjs b/web/tests/compose.test.cjs
index e2036c05c27..6bf9249fa8e 100644
--- a/web/tests/compose.test.cjs
+++ b/web/tests/compose.test.cjs
@@ -822,7 +822,7 @@ test_ui("on_events", ({override, override_rewire}) => {
(function test_undo_markdown_preview_clicked() {
fake_compose_box.show_message_preview();
- override_rewire(compose_recipient, "update_placeholder_text", noop);
+ override_rewire(compose_recipient, "update_compose_area_placeholder_text", noop);
override(narrow_state, "narrowed_by_reply", () => true);
override(
compose_notifications,
diff --git a/web/tests/compose_validate.test.cjs b/web/tests/compose_validate.test.cjs
index 835f3cd01f9..afe9373c50e 100644
--- a/web/tests/compose_validate.test.cjs
+++ b/web/tests/compose_validate.test.cjs
@@ -165,7 +165,7 @@ function initialize_pm_pill(mock_template) {
$("#private_message_recipient").before = noop;
compose_pm_pill.initialize({
- on_pill_create_or_remove: compose_recipient.update_placeholder_text,
+ on_pill_create_or_remove: compose_recipient.update_compose_area_placeholder_text,
});
$("#zephyr-mirror-error").is = noop;
diff --git a/web/tests/composebox_typeahead.test.cjs b/web/tests/composebox_typeahead.test.cjs
index 6d68c80c819..f2de22ac5cd 100644
--- a/web/tests/composebox_typeahead.test.cjs
+++ b/web/tests/composebox_typeahead.test.cjs
@@ -1087,7 +1087,7 @@ test("initialize", ({override, override_rewire, mock_template}) => {
},
}));
compose_pm_pill.initialize({
- on_pill_create_or_remove: compose_recipient.update_placeholder_text,
+ on_pill_create_or_remove: compose_recipient.update_compose_area_placeholder_text,
});
let expected_value;