From 3b09dda87911261ee517656b59808bb5971f29a2 Mon Sep 17 00:00:00 2001 From: Yashashvi Dave Date: Fri, 18 May 2018 18:09:02 +0530 Subject: [PATCH] edit bot: Fix UI element shows incorrect interface for outgoing webhook. Dropdown element for outgoing interface type was not showing correct value, cause the way default value was set to dropdown was incorrect (it should have been setting the selected parameter on the selected option if it were going to be selected via the template code). Fixes #9419. --- frontend_tests/node_tests/templates.js | 4 ++-- static/js/settings_bots.js | 1 + .../settings/edit-outgoing-webhook-service.handlebars | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js index 1b091fb689..0a26f7d7c7 100644 --- a/frontend_tests/node_tests/templates.js +++ b/frontend_tests/node_tests/templates.js @@ -1573,8 +1573,8 @@ run_test('handlebars_bug', () => { interface: "1"}, }; var html = render('edit-outgoing-webhook-service', args); - assert.equal($(html).find('#edit_service_base_url').attr('value'), args.service.base_url); - assert.equal($(html).find('#edit_service_interface').attr('value'), args.service.interface); + assert.equal($(html).find('#edit_service_base_url').val(), args.service.base_url); + assert.equal($(html).find('#edit_service_interface').val(), args.service.interface); }()); (function edit_embedded_bot_service() { diff --git a/static/js/settings_bots.js b/static/js/settings_bots.js index 9921c0d32f..8a13afa47b 100644 --- a/static/js/settings_bots.js +++ b/static/js/settings_bots.js @@ -373,6 +373,7 @@ exports.set_up = function () { if (bot.bot_type.toString() === OUTGOING_WEBHOOK_BOT_TYPE) { $("#service_data").append(templates.render("edit-outgoing-webhook-service", {service: service})); + $("#edit_service_interface").val(service.interface); } if (bot.bot_type.toString() === EMBEDDED_BOT_TYPE) { $("#service_data").append(templates.render("edit-embedded-bot-service", diff --git a/static/templates/settings/edit-outgoing-webhook-service.handlebars b/static/templates/settings/edit-outgoing-webhook-service.handlebars index 00d8f97cc2..7721ee7cc4 100644 --- a/static/templates/settings/edit-outgoing-webhook-service.handlebars +++ b/static/templates/settings/edit-outgoing-webhook-service.handlebars @@ -5,7 +5,7 @@
-