mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 03:25:47 +08:00
REFACTOR: removes use of undeclared variable (#9682)
This commit is contained in:
parent
af78d188b8
commit
9846c43d93
|
@ -31,25 +31,24 @@ export default Component.extend({
|
||||||
|
|
||||||
@observes("nameInput")
|
@observes("nameInput")
|
||||||
_validateName() {
|
_validateName() {
|
||||||
name = this.nameInput;
|
if (this.nameInput === this.get("model.name")) return;
|
||||||
if (name === this.get("model.name")) return;
|
|
||||||
|
|
||||||
if (name === undefined) {
|
if (this.nameInput === undefined) {
|
||||||
return this._failedInputValidation();
|
return this._failedInputValidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === "") {
|
if (this.nameInput === "") {
|
||||||
this.set("uniqueNameValidation", null);
|
this.set("uniqueNameValidation", null);
|
||||||
return this._failedInputValidation(I18n.t("admin.groups.new.name.blank"));
|
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(
|
return this._failedInputValidation(
|
||||||
I18n.t("admin.groups.new.name.too_short")
|
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(
|
return this._failedInputValidation(
|
||||||
I18n.t("admin.groups.new.name.too_long")
|
I18n.t("admin.groups.new.name.too_long")
|
||||||
);
|
);
|
||||||
|
@ -63,10 +62,9 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
checkGroupName: discourseDebounce(function() {
|
checkGroupName: discourseDebounce(function() {
|
||||||
name = this.nameInput;
|
if (isEmpty(this.nameInput)) return;
|
||||||
if (isEmpty(name)) return;
|
|
||||||
|
|
||||||
Group.checkName(name)
|
Group.checkName(this.nameInput)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const validationName = "uniqueNameValidation";
|
const validationName = "uniqueNameValidation";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user