Skip to content

A platform for community discussion. Free, open, simple.

REFACTOR: removes use of undeclared variable (#9682)

Joffrey JAFFEUX9846c43d9320
diff --git a/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.js b/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.js
index 988e4ac843f..39077b9257c 100644
--- a/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.js
+++ b/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.js
@@ -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";