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) {
|
||||
alert(_.errors.name._errors[0].message);
|
||||
} else {
|
||||
loading.hide();
|
||||
full.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
form.addFileInput(I18n.getTranslation("guild.icon:"), "icon", {files: "one"});
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1219,6 +1219,7 @@ class Form implements OptionsElement<object> {
|
|||
addPreprocessor(func: (obj: Object) => void) {
|
||||
this.preprocessor = func;
|
||||
}
|
||||
onFormError = (f: FormError) => {};
|
||||
async submit() {
|
||||
if (this.options.subOptions) {
|
||||
this.options.subOptions.submit();
|
||||
|
@ -1233,6 +1234,7 @@ class Form implements OptionsElement<object> {
|
|||
(build as any)[key] = thing();
|
||||
} catch (e: any) {
|
||||
if (e instanceof FormError) {
|
||||
this.onFormError(e);
|
||||
const elm = this.options.html.get(e.elem);
|
||||
if (elm) {
|
||||
const html = elm.deref();
|
||||
|
@ -1290,6 +1292,7 @@ class Form implements OptionsElement<object> {
|
|||
this.preprocessor(build);
|
||||
} catch (e) {
|
||||
if (e instanceof FormError) {
|
||||
this.onFormError(e);
|
||||
const elm = this.options.html.get(e.elem);
|
||||
if (elm) {
|
||||
const html = elm.deref();
|
||||
|
@ -1324,6 +1327,7 @@ class Form implements OptionsElement<object> {
|
|||
} catch (e) {
|
||||
console.error(e);
|
||||
if (e instanceof FormError) {
|
||||
this.onFormError(e);
|
||||
const elm = this.options.html.get(e.elem);
|
||||
if (elm) {
|
||||
const html = elm.deref();
|
||||
|
@ -1340,6 +1344,7 @@ class Form implements OptionsElement<object> {
|
|||
await this.onSubmit(build, build);
|
||||
} catch (e) {
|
||||
if (e instanceof FormError) {
|
||||
this.onFormError(e);
|
||||
const elm = this.options.html.get(e.elem);
|
||||
if (elm) {
|
||||
const html = elm.deref();
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
"roleColors": "Disable role colors"
|
||||
},
|
||||
"channel": {
|
||||
"creating": "Creating channel",
|
||||
"name": "Channel",
|
||||
"copyId": "Copy channel id",
|
||||
"markRead": "Mark as read",
|
||||
|
@ -236,6 +237,7 @@
|
|||
"nevermind": "Nevermind",
|
||||
"submit": "submit",
|
||||
"guild": {
|
||||
"creating": "Creating guild",
|
||||
"copyId": "Copy guild id",
|
||||
"markRead": "Mark as read",
|
||||
"notifications": "Notifications",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue