The discussion revolves around fixing deprecation warnings in Discourse, specifically the one that states “Import the User class instead of using User (deprecated since Discourse 2.4.0) (removal in Discourse 2.6.0)”.
Varsii is trying to debug the issue from their theme and found the problematic code: var currentUser = Discourse.User.current();. Falco suggests replacing this line with var currentUser = api.getCurrentUser();, eliminating the need to import the User class.
Others have similar issues, such as frictionel with Discourse.Site.currentProp('user_fields'), and iidbae with the same deprecation notice in Discourse 2.6.0.beta3. RGJ notes that these notices are targeted towards theme and plugin developers.
riking provides additional guidance for theme developers using more than just User.current(), suggesting the replacement const User = require('discourse/model/user').default;.
Hello dear community,
I have some time to fix the warnings in our community. One of them is the following:
Deprecation notice: Import the User class instead of using User (deprecated since Discourse 2.4.0) (removal in Discourse 2.6.0)
I’m trying to debug if from the DevTools but It does not let me enter the file where the warning is coming from. It says:
Could not load content for URL/assets/var/www/discourse/public/assets/_application-d88a387e24ec4397c59d853355d071080a32aa58498a2ea0a509cebee72839c0.js : HTTP status code: 404
Anyway, I entered the safe mode with leaving only the theme. It looks like the warning is coming from my theme. In my theme I found out that I use in an HTML file:
Awesome! thank you very much
It looks like I have more places to fix like Discourse.Site.currentProp('trustLevels').
Is there a proper documentation I could read in order to understand which method to use instead of the old ones?
I have same problem, Deprecation notice: Import the User class instead of using User (deprecated since Discourse 2.4.0) (removal in Discourse 2.6.0) in latest version, 2.6.0.beta3.
My forum runs slowly for first time user visit.
Could you explain me where should I start? How to change that value? From Admin area?