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

This commit is contained in:
Robin Ward 2020-07-22 11:54:22 -04:00
parent 94419d0176
commit 4ecb4439b9
3 changed files with 10 additions and 3 deletions

View File

@ -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: {

View File

@ -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, {

View File

@ -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(