REFACTOR: Deprecate Discourse.Site and Discourse.User

This commit is contained in:
Robin Ward
2019-11-12 10:34:50 -05:00
parent 3dd2f2f701
commit 7f651b9666
4 changed files with 34 additions and 41 deletions

View File

@ -25,6 +25,7 @@ import { userPath } from "discourse/lib/url";
import Category from "discourse/models/category";
import { Promise } from "rsvp";
import { getProperties } from "@ember/object";
import deprecated from "discourse-common/lib/deprecated";
export const SECOND_FACTOR_METHODS = {
TOTP: 1,
@ -901,4 +902,18 @@ User.reopenClass(Singleton, {
}
});
let warned = false;
Object.defineProperty(Discourse, "User", {
get() {
if (!warned) {
deprecated("Import the User class instead of using Discourse.User", {
since: "2.4.0",
dropFrom: "2.6.0"
});
warned = true;
}
return User;
}
});
export default User;