REFACTOR: removes use of undeclared variable (#9682)

This commit is contained in:
Joffrey JAFFEUX 2020-05-07 16:37:56 +02:00 committed by GitHub
parent af78d188b8
commit 9846c43d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,25 +31,24 @@ export default Component.extend({
@observes("nameInput")
_validateName() {
name = this.nameInput;
if (name === this.get("model.name")) return;
if (this.nameInput === this.get("model.name")) return;
if (name === undefined) {
if (this.nameInput === undefined) {
return this._failedInputValidation();
}
if (name === "") {
if (this.nameInput === "") {
this.set("uniqueNameValidation", null);
return this._failedInputValidation(I18n.t("admin.groups.new.name.blank"));
}
if (name.length < this.siteSettings.min_username_length) {
if (this.nameInput.length < this.siteSettings.min_username_length) {
return this._failedInputValidation(
I18n.t("admin.groups.new.name.too_short")
);
}
if (name.length > this.siteSettings.max_username_length) {
if (this.nameInput.length > this.siteSettings.max_username_length) {
return this._failedInputValidation(
I18n.t("admin.groups.new.name.too_long")
);
@ -63,10 +62,9 @@ export default Component.extend({
},
checkGroupName: discourseDebounce(function() {
name = this.nameInput;
if (isEmpty(name)) return;
if (isEmpty(this.nameInput)) return;
Group.checkName(name)
Group.checkName(this.nameInput)
.then(response => {
const validationName = "uniqueNameValidation";