FIX: explicit assign on user selection (#184)

FIX: explicit assign on user selection (#184)

Also drops autofocus as it’s the first item in the form

diff --git a/assets/javascripts/discourse-assign/controllers/assign-user.js.es6 b/assets/javascripts/discourse-assign/controllers/assign-user.js.es6
index 563b520..7a84d56 100644
--- a/assets/javascripts/discourse-assign/controllers/assign-user.js.es6
+++ b/assets/javascripts/discourse-assign/controllers/assign-user.js.es6
@@ -46,7 +46,8 @@ export default Controller.extend({
       "model.username": user.username,
       "model.allowedGroups": this.taskActions.allowedGroups,
     });
-    this.send("assign");
+
+    return this.assign();
   },
 
   @action
@@ -80,7 +81,7 @@ export default Controller.extend({
   },
 
   @action
-  updateUsername(selected) {
-    this.set("model.username", selected.firstObject);
+  assignUsername(selected) {
+    this.assignUser({ username: selected.firstObject });
   },
 });
diff --git a/assets/javascripts/discourse/templates/modal/assign-user.hbs b/assets/javascripts/discourse/templates/modal/assign-user.hbs
index e84b405..33752de 100644
--- a/assets/javascripts/discourse/templates/modal/assign-user.hbs
+++ b/assets/javascripts/discourse/templates/modal/assign-user.hbs
@@ -3,15 +3,15 @@
     {{i18n "discourse_assign.assign_modal.description"}}
     {{email-group-user-chooser
       autocomplete="off"
-      autofocus="autofocus"
       value=model.username
-      onChange=(action "updateUsername")
+      onChange=(action "assignUsername")
       options=(hash
         filterPlaceholder=placeholderKey
         includeGroups=false
         groupMembersOf=allowedGroups
         maximum=1
         autofocus=autofocus
+        tabindex=1
       )
     }}
     <div class="assign-suggestions">
@@ -27,7 +27,8 @@
 <div class="modal-footer">
   {{d-button
     label="discourse_assign.assign_modal.assign"
-    icon=inviteIcon action=(action "assign")
+    icon=inviteIcon
+    action=(action "assign")
     class="btn-primary"
     disabled=disabled
   }}

GitHub sha: 92a1167a687e38258b99f77f4ad11c1c6bf67edd

This commit appears in #184 which was approved by tgxworld. It was merged by jjaffeux.