mirror of https://github.com/vector-im/riot-web
Limit the length of poll questions and answers to 340 characters (#7166)
parent
a2c662272e
commit
39e47e0375
|
@ -37,6 +37,8 @@ interface IState extends IScrollableBaseState {
|
||||||
const MIN_OPTIONS = 2;
|
const MIN_OPTIONS = 2;
|
||||||
const MAX_OPTIONS = 20;
|
const MAX_OPTIONS = 20;
|
||||||
const DEFAULT_NUM_OPTIONS = 2;
|
const DEFAULT_NUM_OPTIONS = 2;
|
||||||
|
const MAX_QUESTION_LENGTH = 340;
|
||||||
|
const MAX_OPTION_LENGTH = 340;
|
||||||
|
|
||||||
export default class PollCreateDialog extends ScrollableBaseModal<IProps, IState> {
|
export default class PollCreateDialog extends ScrollableBaseModal<IProps, IState> {
|
||||||
private addOptionRef = createRef<HTMLDivElement>();
|
private addOptionRef = createRef<HTMLDivElement>();
|
||||||
|
@ -111,6 +113,7 @@ export default class PollCreateDialog extends ScrollableBaseModal<IProps, IState
|
||||||
<h2>{ _t("What is your poll question or topic?") }</h2>
|
<h2>{ _t("What is your poll question or topic?") }</h2>
|
||||||
<Field
|
<Field
|
||||||
value={this.state.question}
|
value={this.state.question}
|
||||||
|
maxLength={MAX_QUESTION_LENGTH}
|
||||||
label={_t("Question or topic")}
|
label={_t("Question or topic")}
|
||||||
placeholder={_t("Write something...")}
|
placeholder={_t("Write something...")}
|
||||||
onChange={this.onQuestionChange}
|
onChange={this.onQuestionChange}
|
||||||
|
@ -121,6 +124,7 @@ export default class PollCreateDialog extends ScrollableBaseModal<IProps, IState
|
||||||
this.state.options.map((op, i) => <div key={`option_${i}`} className="mx_PollCreateDialog_option">
|
this.state.options.map((op, i) => <div key={`option_${i}`} className="mx_PollCreateDialog_option">
|
||||||
<Field
|
<Field
|
||||||
value={op}
|
value={op}
|
||||||
|
maxLength={MAX_OPTION_LENGTH}
|
||||||
label={_t("Option %(number)s", { number: i + 1 })}
|
label={_t("Option %(number)s", { number: i + 1 })}
|
||||||
placeholder={_t("Write an option")}
|
placeholder={_t("Write an option")}
|
||||||
onChange={e => this.onOptionChange(i, e)}
|
onChange={e => this.onOptionChange(i, e)}
|
||||||
|
|
Loading…
Reference in New Issue