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.

dropdown list: Separate get_data() function, no functional change.

evykassirere786c3ac98b1
diff --git a/web/src/dropdown_list_widget.js b/web/src/dropdown_list_widget.js
index 129d5aa1927..4e1c0f0f69c 100644
--- a/web/src/dropdown_list_widget.js
+++ b/web/src/dropdown_list_widget.js
@@ -99,6 +99,13 @@ export class DropdownListWidget {
});
}
+ get_data = (data) => {
+ if (this.include_current_item) {
+ return data;
+ }
+ return data.filter((x) => x.value !== this.value.toString());
+ };
+
setup_dropdown_widget(data) {
const $dropdown_list_body = $(
`#${CSS.escape(this.container_id)} .dropdown-list-body`,
@@ -106,14 +113,8 @@ export class DropdownListWidget {
const $search_input = $(
`#${CSS.escape(this.container_id)} .dropdown-search > input[type=text]`,
);
- const get_data = () => {
- if (this.include_current_item) {
- return data;
- }
- return data.filter((x) => x.value !== this.value.toString());
- };
- ListWidget.create($dropdown_list_body, get_data(data), {
+ ListWidget.create($dropdown_list_body, this.get_data(data), {
name: `${CSS.escape(this.widget_name)}_list`,
modifier(item) {
return render_dropdown_list({item});