DEV: Add safe deprecation to `Discourse.User`

This commit is contained in:
Robin Ward 2020-05-11 16:08:12 -04:00
parent 46730a2f0d
commit b4bd238dd6
1 changed files with 14 additions and 12 deletions

View File

@ -990,6 +990,7 @@ User.reopenClass(Singleton, {
} }
}); });
if (typeof Discourse !== "undefined") {
let warned = false; let warned = false;
Object.defineProperty(Discourse, "User", { Object.defineProperty(Discourse, "User", {
get() { get() {
@ -1003,5 +1004,6 @@ Object.defineProperty(Discourse, "User", {
return User; return User;
} }
}); });
}
export default User; export default User;