REFACTOR: Remove `Discourse.SiteSettings` from lightbox.js

REFACTOR: Remove Discourse.SiteSettings from lightbox.js

diff --git a/app/assets/javascripts/discourse/app/components/image-uploader.js b/app/assets/javascripts/discourse/app/components/image-uploader.js
index 5285d5b..5f5c092 100644
--- a/app/assets/javascripts/discourse/app/components/image-uploader.js
+++ b/app/assets/javascripts/discourse/app/components/image-uploader.js
@@ -86,7 +86,7 @@ export default Component.extend(UploadMixin, {
   },
 
   _applyLightbox() {
-    if (this.imageUrl) next(() => lightbox(this.element));
+    if (this.imageUrl) next(() => lightbox(this.element, this.siteSettings));
   },
 
   actions: {
diff --git a/app/assets/javascripts/discourse/app/initializers/post-decorations.js b/app/assets/javascripts/discourse/app/initializers/post-decorations.js
index 25c3b1c..9fb4440 100644
--- a/app/assets/javascripts/discourse/app/initializers/post-decorations.js
+++ b/app/assets/javascripts/discourse/app/initializers/post-decorations.js
@@ -12,6 +12,13 @@ export default {
       api.decorateCooked(highlightSyntax, {
         id: "discourse-syntax-highlighting"
       });
+
+      api.decorateCookedElement(
+        elem => {
+          return lightbox(elem, siteSettings);
+        },
+        { id: "discourse-lightbox" }
+      );
       api.decorateCookedElement(lightbox, { id: "discourse-lightbox" });
       if (siteSettings.support_mixed_text_direction) {
         api.decorateCooked(setTextDirections, {
diff --git a/app/assets/javascripts/discourse/app/lib/lightbox.js b/app/assets/javascripts/discourse/app/lib/lightbox.js
index a22b8fc..28b6fe6 100644
--- a/app/assets/javascripts/discourse/app/lib/lightbox.js
+++ b/app/assets/javascripts/discourse/app/lib/lightbox.js
@@ -6,7 +6,7 @@ import { isAppWebview, postRNWebviewMessage } from "discourse/lib/utilities";
 import { spinnerHTML } from "discourse/helpers/loading-spinner";
 import User from "discourse/models/user";
 
-export default function(elem) {
+export default function(elem, siteSettings) {
   if (!elem) {
     return;
   }
@@ -76,7 +76,7 @@ export default function(elem) {
             $("span.informations", item.el).text()
           ];
           if (
-            !Discourse.SiteSettings.prevent_anons_from_downloading_files ||
+            !siteSettings.prevent_anons_from_downloading_files ||
             User.current()
           ) {
             src.push(

GitHub sha: 4ecb4439

This commit appears in #10290 which was merged by eviltrout.