Merge pull request #4579 from matrix-org/t3chguy/create_room_public
Default to public room when creating room from room directorypull/21833/head
commit
77e32977dc
|
@ -623,7 +623,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'view_create_room':
|
case 'view_create_room':
|
||||||
this.createRoom();
|
this.createRoom(payload.public);
|
||||||
break;
|
break;
|
||||||
case 'view_create_group': {
|
case 'view_create_group': {
|
||||||
const CreateGroupDialog = sdk.getComponent("dialogs.CreateGroupDialog");
|
const CreateGroupDialog = sdk.getComponent("dialogs.CreateGroupDialog");
|
||||||
|
@ -1012,9 +1012,9 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
}).close;
|
}).close;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createRoom() {
|
private async createRoom(defaultPublic = false) {
|
||||||
const CreateRoomDialog = sdk.getComponent('dialogs.CreateRoomDialog');
|
const CreateRoomDialog = sdk.getComponent('dialogs.CreateRoomDialog');
|
||||||
const modal = Modal.createTrackedDialog('Create Room', '', CreateRoomDialog);
|
const modal = Modal.createTrackedDialog('Create Room', '', CreateRoomDialog, { defaultPublic });
|
||||||
|
|
||||||
const [shouldCreate, opts] = await modal.finished;
|
const [shouldCreate, opts] = await modal.finished;
|
||||||
if (shouldCreate) {
|
if (shouldCreate) {
|
||||||
|
|
|
@ -367,7 +367,10 @@ export default createReactClass({
|
||||||
|
|
||||||
onCreateRoomClick: function(room) {
|
onCreateRoomClick: function(room) {
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
dis.dispatch({action: 'view_create_room'});
|
dis.dispatch({
|
||||||
|
action: 'view_create_room',
|
||||||
|
public: true,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
showRoomAlias: function(alias, autoJoin=false) {
|
showRoomAlias: function(alias, autoJoin=false) {
|
||||||
|
|
|
@ -30,12 +30,13 @@ export default createReactClass({
|
||||||
displayName: 'CreateRoomDialog',
|
displayName: 'CreateRoomDialog',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
onFinished: PropTypes.func.isRequired,
|
onFinished: PropTypes.func.isRequired,
|
||||||
|
defaultPublic: PropTypes.bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
const config = SdkConfig.get();
|
const config = SdkConfig.get();
|
||||||
return {
|
return {
|
||||||
isPublic: false,
|
isPublic: this.props.defaultPublic || false,
|
||||||
isEncrypted: true,
|
isEncrypted: true,
|
||||||
name: "",
|
name: "",
|
||||||
topic: "",
|
topic: "",
|
||||||
|
|
Loading…
Reference in New Issue