Revert "DEV: Discourse.User has been deprecated since 2.6"

This reverts commit 3edf24437a.

Too many plugins rely on this right now and need to be updated.
This commit is contained in:
Robin Ward 2021-08-09 13:39:26 -04:00
parent 3edf24437a
commit 5c07e544af

View File

@ -22,6 +22,7 @@ import UserDraftsStream from "discourse/models/user-drafts-stream";
import UserPostsStream from "discourse/models/user-posts-stream";
import UserStream from "discourse/models/user-stream";
import { ajax } from "discourse/lib/ajax";
import deprecated from "discourse-common/lib/deprecated";
import discourseComputed from "discourse-common/utils/decorators";
import { emojiUnescape } from "discourse/lib/text";
import { getOwner } from "discourse-common/lib/get-owner";
@ -1119,4 +1120,20 @@ User.reopenClass(Singleton, {
},
});
if (typeof Discourse !== "undefined") {
let warned = false;
Object.defineProperty(Discourse, "User", {
get() {
if (!warned) {
deprecated("Import the User class instead of using User", {
since: "2.4.0",
dropFrom: "2.6.0",
});
warned = true;
}
return User;
},
});
}
export default User;