prevent guilds from being spam created
This commit is contained in:
parent
dfc702c698
commit
47fe761bc5
3 changed files with 18 additions and 0 deletions
|
@ -1181,12 +1181,23 @@ class Localuser {
|
||||||
if (_.message) {
|
if (_.message) {
|
||||||
alert(_.errors.name._errors[0].message);
|
alert(_.errors.name._errors[0].message);
|
||||||
} else {
|
} else {
|
||||||
|
loading.hide();
|
||||||
full.hide();
|
full.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
form.addFileInput(I18n.getTranslation("guild.icon:"), "icon", {files: "one"});
|
form.addFileInput(I18n.getTranslation("guild.icon:"), "icon", {files: "one"});
|
||||||
form.addTextInput(I18n.getTranslation("guild.name:"), "name", {required: true});
|
form.addTextInput(I18n.getTranslation("guild.name:"), "name", {required: true});
|
||||||
|
const loading = new Dialog("");
|
||||||
|
loading.float.options.addTitle(I18n.guild.creating());
|
||||||
|
form.onFormError = () => {
|
||||||
|
loading.hide();
|
||||||
|
full.show();
|
||||||
|
};
|
||||||
|
form.addPreprocessor(() => {
|
||||||
|
loading.show();
|
||||||
|
full.hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
full.show();
|
full.show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1219,6 +1219,7 @@ class Form implements OptionsElement<object> {
|
||||||
addPreprocessor(func: (obj: Object) => void) {
|
addPreprocessor(func: (obj: Object) => void) {
|
||||||
this.preprocessor = func;
|
this.preprocessor = func;
|
||||||
}
|
}
|
||||||
|
onFormError = (f: FormError) => {};
|
||||||
async submit() {
|
async submit() {
|
||||||
if (this.options.subOptions) {
|
if (this.options.subOptions) {
|
||||||
this.options.subOptions.submit();
|
this.options.subOptions.submit();
|
||||||
|
@ -1233,6 +1234,7 @@ class Form implements OptionsElement<object> {
|
||||||
(build as any)[key] = thing();
|
(build as any)[key] = thing();
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e instanceof FormError) {
|
if (e instanceof FormError) {
|
||||||
|
this.onFormError(e);
|
||||||
const elm = this.options.html.get(e.elem);
|
const elm = this.options.html.get(e.elem);
|
||||||
if (elm) {
|
if (elm) {
|
||||||
const html = elm.deref();
|
const html = elm.deref();
|
||||||
|
@ -1290,6 +1292,7 @@ class Form implements OptionsElement<object> {
|
||||||
this.preprocessor(build);
|
this.preprocessor(build);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof FormError) {
|
if (e instanceof FormError) {
|
||||||
|
this.onFormError(e);
|
||||||
const elm = this.options.html.get(e.elem);
|
const elm = this.options.html.get(e.elem);
|
||||||
if (elm) {
|
if (elm) {
|
||||||
const html = elm.deref();
|
const html = elm.deref();
|
||||||
|
@ -1324,6 +1327,7 @@ class Form implements OptionsElement<object> {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
if (e instanceof FormError) {
|
if (e instanceof FormError) {
|
||||||
|
this.onFormError(e);
|
||||||
const elm = this.options.html.get(e.elem);
|
const elm = this.options.html.get(e.elem);
|
||||||
if (elm) {
|
if (elm) {
|
||||||
const html = elm.deref();
|
const html = elm.deref();
|
||||||
|
@ -1340,6 +1344,7 @@ class Form implements OptionsElement<object> {
|
||||||
await this.onSubmit(build, build);
|
await this.onSubmit(build, build);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof FormError) {
|
if (e instanceof FormError) {
|
||||||
|
this.onFormError(e);
|
||||||
const elm = this.options.html.get(e.elem);
|
const elm = this.options.html.get(e.elem);
|
||||||
if (elm) {
|
if (elm) {
|
||||||
const html = elm.deref();
|
const html = elm.deref();
|
||||||
|
|
|
@ -150,6 +150,7 @@
|
||||||
"roleColors": "Disable role colors"
|
"roleColors": "Disable role colors"
|
||||||
},
|
},
|
||||||
"channel": {
|
"channel": {
|
||||||
|
"creating": "Creating channel",
|
||||||
"name": "Channel",
|
"name": "Channel",
|
||||||
"copyId": "Copy channel id",
|
"copyId": "Copy channel id",
|
||||||
"markRead": "Mark as read",
|
"markRead": "Mark as read",
|
||||||
|
@ -236,6 +237,7 @@
|
||||||
"nevermind": "Nevermind",
|
"nevermind": "Nevermind",
|
||||||
"submit": "submit",
|
"submit": "submit",
|
||||||
"guild": {
|
"guild": {
|
||||||
|
"creating": "Creating guild",
|
||||||
"copyId": "Copy guild id",
|
"copyId": "Copy guild id",
|
||||||
"markRead": "Mark as read",
|
"markRead": "Mark as read",
|
||||||
"notifications": "Notifications",
|
"notifications": "Notifications",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue