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.

input_pill: Refactor `payload` object in `appendValidatedData` function.

Lalitc0e9e463fbd1
diff --git a/web/src/input_pill.js b/web/src/input_pill.js
index 560db7f5e5a..c6da225e2c8 100644
--- a/web/src/input_pill.js
+++ b/web/src/input_pill.js
@@ -89,12 +89,6 @@ export function create(opts) {
return;
}
- const payload = {
- item,
- };
-
- store.pills.push(payload);
-
const has_image = item.img_src !== undefined;
const opts = {
@@ -120,7 +114,12 @@ export function create(opts) {
}
const pill_html = render_input_pill(opts);
- payload.$element = $(pill_html);
+ const payload = {
+ item,
+ $element: $(pill_html),
+ };
+
+ store.pills.push(payload);
store.$input.before(payload.$element);
},