Enforce required validation on signup answers (#2865)

This commit is contained in:
anhcuky 2024-12-19 05:28:26 +07:00 committed by GitHub
parent 6e04efab2d
commit 634c901262
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 8 deletions

View file

@ -4,6 +4,7 @@ import autosize from "autosize";
import classNames from "classnames";
import { NoOptionI18nKeys } from "i18next";
import { Component, linkEvent } from "inferno";
import { createElement } from "inferno-create-element";
import { Prompt } from "inferno-router";
import { Language } from "lemmy-js-client";
import {
@ -52,6 +53,7 @@ interface MarkdownTextAreaProps {
onSubmit?(content: string, languageId?: number): Promise<boolean>;
allLanguages: Language[]; // TODO should probably be nullable
siteLanguages: number[]; // TODO same
renderAsDiv?: boolean;
}
interface ImageUploadStatus {
@ -114,13 +116,16 @@ export class MarkdownTextArea extends Component<
render() {
const languageId = this.state.languageId;
return (
<form
className="markdown-textarea"
id={this.formId}
onSubmit={linkEvent(this, this.handleSubmit)}
>
return createElement(
this.props.renderAsDiv ? "div" : "form",
{
className: "markdown-textarea",
id: this.formId,
onSubmit: this.props.renderAsDiv
? undefined
: linkEvent(this, this.handleSubmit),
},
<>
<Prompt
message={I18NextService.i18n.t("block_leaving")}
when={
@ -306,7 +311,7 @@ export class MarkdownTextArea extends Component<
)}
</div>
</div>
</form>
</>,
);
}

View file

@ -303,6 +303,7 @@ export class Signup extends Component<SignupRouteProps, State> {
hideNavigationWarnings
allLanguages={[]}
siteLanguages={[]}
renderAsDiv={true}
/>
</div>
</div>