mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 21:04:59 +08:00
DEV: delete nameValidation mixin (#31275)
This mixin is now ready for deletion, all uses of it has been removed from plugins.
This commit is contained in:
parent
13a5e5b297
commit
441620ce61
@ -1,43 +0,0 @@
|
||||
import EmberObject, { computed } from "@ember/object";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import deprecated from "discourse/lib/deprecated";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
export default Mixin.create({
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
deprecated(
|
||||
"NameValidation mixin is deprecated. Use the helper class from discourse/lib/name-validation-helper instead.",
|
||||
{
|
||||
id: "discourse.name-validation-mixin",
|
||||
since: "v3.4.0.beta4-dev",
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
get nameTitle() {
|
||||
return i18n(
|
||||
this.site.full_name_required_for_signup
|
||||
? "user.name.title"
|
||||
: "user.name.title_optional"
|
||||
);
|
||||
},
|
||||
|
||||
// Validate the name.
|
||||
nameValidation: computed("accountName", "forceValidationReason", function () {
|
||||
const { accountName, forceValidationReason } = this;
|
||||
if (this.site.full_name_required_for_signup && isEmpty(accountName)) {
|
||||
return EmberObject.create({
|
||||
failed: true,
|
||||
ok: false,
|
||||
message: i18n("user.name.required"),
|
||||
reason: forceValidationReason ? i18n("user.name.required") : null,
|
||||
element: document.querySelector("#new-account-name"),
|
||||
});
|
||||
}
|
||||
|
||||
return EmberObject.create({ ok: true });
|
||||
}),
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user