mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Merge pull request #6921 from matrix-org/t3chguy/fix/19003.1
This commit is contained in:
commit
53d7c9d2e5
2 changed files with 7 additions and 8 deletions
|
@ -143,6 +143,10 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
|
||||||
|
|
||||||
public focus() {
|
public focus() {
|
||||||
this.input.focus();
|
this.input.focus();
|
||||||
|
// programmatic does not fire onFocus handler
|
||||||
|
this.setState({
|
||||||
|
focused: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private onFocus = (ev) => {
|
private onFocus = (ev) => {
|
||||||
|
|
|
@ -214,7 +214,6 @@ export const SpaceCreateForm: React.FC<ISpaceCreateFormProps> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const SpaceCreateMenu = ({ onFinished }) => {
|
const SpaceCreateMenu = ({ onFinished }) => {
|
||||||
const cli = useContext(MatrixClientContext);
|
|
||||||
const [visibility, setVisibility] = useState<Visibility>(null);
|
const [visibility, setVisibility] = useState<Visibility>(null);
|
||||||
const [busy, setBusy] = useState<boolean>(false);
|
const [busy, setBusy] = useState<boolean>(false);
|
||||||
|
|
||||||
|
@ -238,13 +237,9 @@ const SpaceCreateMenu = ({ onFinished }) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate the space alias field but do not require it
|
if (visibility === Visibility.Public && !(await spaceAliasField.current.validate({ allowEmpty: false }))) {
|
||||||
const aliasLocalpart = alias.substring(1, alias.length - cli.getDomain().length - 1);
|
|
||||||
if (visibility === Visibility.Public && aliasLocalpart &&
|
|
||||||
(await spaceAliasField.current.validate({ allowEmpty: true })) === false
|
|
||||||
) {
|
|
||||||
spaceAliasField.current.focus();
|
spaceAliasField.current.focus();
|
||||||
spaceAliasField.current.validate({ allowEmpty: true, focused: true });
|
spaceAliasField.current.validate({ allowEmpty: false, focused: true });
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +248,7 @@ const SpaceCreateMenu = ({ onFinished }) => {
|
||||||
await createSpace(
|
await createSpace(
|
||||||
name,
|
name,
|
||||||
visibility === Visibility.Public,
|
visibility === Visibility.Public,
|
||||||
aliasLocalpart ? alias : undefined,
|
alias,
|
||||||
topic,
|
topic,
|
||||||
avatar,
|
avatar,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue