Pre-populate create room dialog name when going from room directory
This commit is contained in:
parent
b3aade075d
commit
8b67cdb80b
3 changed files with 9 additions and 4 deletions
|
@ -665,7 +665,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'view_create_room':
|
case 'view_create_room':
|
||||||
this.createRoom(payload.public);
|
this.createRoom(payload.public, payload.defaultName);
|
||||||
break;
|
break;
|
||||||
case 'view_create_group': {
|
case 'view_create_group': {
|
||||||
let CreateGroupDialog = sdk.getComponent("dialogs.CreateGroupDialog")
|
let CreateGroupDialog = sdk.getComponent("dialogs.CreateGroupDialog")
|
||||||
|
@ -1011,7 +1011,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createRoom(defaultPublic = false) {
|
private async createRoom(defaultPublic = false, defaultName?: string) {
|
||||||
const communityId = CommunityPrototypeStore.instance.getSelectedCommunityId();
|
const communityId = CommunityPrototypeStore.instance.getSelectedCommunityId();
|
||||||
if (communityId) {
|
if (communityId) {
|
||||||
// double check the user will have permission to associate this room with the community
|
// double check the user will have permission to associate this room with the community
|
||||||
|
@ -1025,7 +1025,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const CreateRoomDialog = sdk.getComponent('dialogs.CreateRoomDialog');
|
const CreateRoomDialog = sdk.getComponent('dialogs.CreateRoomDialog');
|
||||||
const modal = Modal.createTrackedDialog('Create Room', '', CreateRoomDialog, { defaultPublic });
|
const modal = Modal.createTrackedDialog('Create Room', '', CreateRoomDialog, {
|
||||||
|
defaultPublic,
|
||||||
|
defaultName,
|
||||||
|
});
|
||||||
|
|
||||||
const [shouldCreate, opts] = await modal.finished;
|
const [shouldCreate, opts] = await modal.finished;
|
||||||
if (shouldCreate) {
|
if (shouldCreate) {
|
||||||
|
|
|
@ -462,6 +462,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_create_room',
|
action: 'view_create_room',
|
||||||
public: true,
|
public: true,
|
||||||
|
defaultName: this.state.filterString.trim(),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import BaseDialog from "../dialogs/BaseDialog";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
defaultPublic?: boolean;
|
defaultPublic?: boolean;
|
||||||
|
defaultName?: string;
|
||||||
parentSpace?: Room;
|
parentSpace?: Room;
|
||||||
onFinished(proceed: boolean, opts?: IOpts): void;
|
onFinished(proceed: boolean, opts?: IOpts): void;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +63,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
||||||
this.state = {
|
this.state = {
|
||||||
isPublic: this.props.defaultPublic || false,
|
isPublic: this.props.defaultPublic || false,
|
||||||
isEncrypted: privateShouldBeEncrypted(),
|
isEncrypted: privateShouldBeEncrypted(),
|
||||||
name: "",
|
name: this.props.defaultName || "",
|
||||||
topic: "",
|
topic: "",
|
||||||
alias: "",
|
alias: "",
|
||||||
detailsOpen: false,
|
detailsOpen: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue