Fix gr-edit-controls

This fixes it so you can restore, delete and rename files.

I accidentially caused a bug with I5948bab3e8b4be672656851235e5367d5160f3ed which caused
the inputs to not be automatically populated.

This also prevented the ability to restore the file.

Change-Id: Ibee72e39dea47fd7e0c0f3b77e7d7f3d6aec62cd
diff --git a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.ts b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.ts
index 4163f9a..944c7d5 100644
--- a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.ts
+++ b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.ts
@@ -176,23 +176,29 @@
       '.dialog'
     ) as NodeListOf<GrDialog>;
     for (const dialog of dialogs) {
-      this._closeDialog(dialog);
+      // We set the second param to false, because this function
+      // is called by _showDialog which when you open either restore,
+      // delete or rename dialogs, it reseted the automatically
+      // set input.
+      this._closeDialog(dialog, false);
     }
   }
 
-  _closeDialog(dialog?: GrDialog) {
+  _closeDialog(dialog?: GrDialog, clearInputs = true) {
     if (!dialog) return;
 
-    // Dialog may have autocompletes and plain inputs -- as these have
-    // different properties representing their bound text, it is easier to
-    // just make two separate queries.
-    dialog.querySelectorAll('gr-autocomplete').forEach(input => {
-      input.text = '';
-    });
+    if (clearInputs) {
+      // Dialog may have autocompletes and plain inputs -- as these have
+      // different properties representing their bound text, it is easier to
+      // just make two separate queries.
+      dialog.querySelectorAll('gr-autocomplete').forEach(input => {
+        input.text = '';
+      });
 
-    dialog.querySelectorAll('iron-input').forEach(input => {
-      input.bindValue = '';
-    });
+      dialog.querySelectorAll('iron-input').forEach(input => {
+        input.bindValue = '';
+      });
+    }
 
     dialog.classList.toggle('invisible', true);
     return this.$.overlay.close();