From cd460155aa1ff77c8ff3b57799734eb23f37a983 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 7 Feb 2022 18:39:34 +0000 Subject: [PATCH] DEV: Add Ember-CLI backwards compatibility for Discourse.Site (#15847) --- .../discourse/app/initializers/inject-objects.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/assets/javascripts/discourse/app/initializers/inject-objects.js b/app/assets/javascripts/discourse/app/initializers/inject-objects.js index b325542587d..e195d4349e6 100644 --- a/app/assets/javascripts/discourse/app/initializers/inject-objects.js +++ b/app/assets/javascripts/discourse/app/initializers/inject-objects.js @@ -1,6 +1,7 @@ import { setDefaultOwner } from "discourse-common/lib/get-owner"; import { isLegacyEmber } from "discourse-common/config/environment"; import User from "discourse/models/user"; +import Site from "discourse/models/site"; import deprecated from "discourse-common/lib/deprecated"; export default { @@ -35,6 +36,18 @@ export default { return User; }, }); + Object.defineProperty(app, "Site", { + get() { + deprecated( + `import discourse/models/site instead of using Discourse.Site`, + { + since: "2.8", + dropFrom: "2.9", + } + ); + return Site; + }, + }); } }, };