Add deprecation for Discourse.SiteSettings in a helper

This commit is contained in:
Robin Ward 2020-07-23 13:49:43 -04:00
parent c4d5c0c91b
commit 8456252c21

View File

@ -1,5 +1,16 @@
import deprecated from "discourse-common/lib/deprecated";
export function prioritizeNameInUx(name, siteSettings) {
siteSettings = siteSettings || Discourse.SiteSettings;
if (!siteSettings) {
deprecated(
"You must supply `prioritizeNameInUx` with a `siteSettings` object",
{
since: "2.6.0",
dropFrom: "2.7.0"
}
);
siteSettings = Discourse.SiteSettings;
}
return (
!siteSettings.prioritize_username_in_ux && name && name.trim().length > 0