mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 02:09:54 +08:00
DEV: Add safe deprecation to Discourse.User
This commit is contained in:
parent
46730a2f0d
commit
b4bd238dd6
|
@ -990,18 +990,20 @@ User.reopenClass(Singleton, {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let warned = false;
|
if (typeof Discourse !== "undefined") {
|
||||||
Object.defineProperty(Discourse, "User", {
|
let warned = false;
|
||||||
get() {
|
Object.defineProperty(Discourse, "User", {
|
||||||
if (!warned) {
|
get() {
|
||||||
deprecated("Import the User class instead of using User", {
|
if (!warned) {
|
||||||
since: "2.4.0",
|
deprecated("Import the User class instead of using User", {
|
||||||
dropFrom: "2.6.0"
|
since: "2.4.0",
|
||||||
});
|
dropFrom: "2.6.0"
|
||||||
warned = true;
|
});
|
||||||
|
warned = true;
|
||||||
|
}
|
||||||
|
return User;
|
||||||
}
|
}
|
||||||
return User;
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
export default User;
|
export default User;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user