UX: Disabled lightbox expand button when loading image meta.

UX: Disabled lightbox expand button when loading image meta.

diff --git a/app/assets/javascripts/discourse/components/image-uploader.js.es6 b/app/assets/javascripts/discourse/components/image-uploader.js.es6
index aaf417e..8ed486a 100644
--- a/app/assets/javascripts/discourse/components/image-uploader.js.es6
+++ b/app/assets/javascripts/discourse/components/image-uploader.js.es6
@@ -6,6 +6,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
 
 export default Ember.Component.extend(UploadMixin, {
   classNames: ["image-uploader"],
+  loadingLightbox: false,
 
   init() {
     this._super(...arguments);
@@ -71,6 +72,8 @@ export default Ember.Component.extend(UploadMixin, {
       if (this.get("imageFilename")) {
         this._openLightbox();
       } else {
+        this.set("loadingLightbox", true);
+
         ajax(`/uploads/lookup-metadata`, {
           type: "POST",
           data: { url: this.get("imageUrl") }
@@ -84,6 +87,7 @@ export default Ember.Component.extend(UploadMixin, {
             });
 
             this._openLightbox();
+            this.set("loadingLightbox", false);
           })
           .catch(popupAjaxError);
       }
diff --git a/app/assets/javascripts/discourse/templates/components/image-uploader.hbs b/app/assets/javascripts/discourse/templates/components/image-uploader.hbs
index d0769d0..c795a85 100644
--- a/app/assets/javascripts/discourse/templates/components/image-uploader.hbs
+++ b/app/assets/javascripts/discourse/templates/components/image-uploader.hbs
@@ -13,7 +13,8 @@
       {{d-button icon="discourse-expand"
           title='expand'
           class="btn image-uploader-lightbox-btn no-text"
-          action=(action "toggleLightbox")}}
+          action=(action "toggleLightbox")
+          disabled=loadingLightbox}}
     {{/if}}
 
     <span class="btn {{unless uploading 'hidden'}}">{{i18n 'upload_selector.uploading'}} {{uploadProgress}}%</span>

GitHub sha: 1dee71d7