Associate created rooms with the selected community
This commit is contained in:
parent
fd71bca7c0
commit
c28134eb11
3 changed files with 19 additions and 1 deletions
|
@ -25,6 +25,8 @@ import { _t } from '../../../languageHandler';
|
||||||
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
||||||
import {Key} from "../../../Keyboard";
|
import {Key} from "../../../Keyboard";
|
||||||
import {privateShouldBeEncrypted} from "../../../createRoom";
|
import {privateShouldBeEncrypted} from "../../../createRoom";
|
||||||
|
import TagOrderStore from "../../../stores/TagOrderStore";
|
||||||
|
import GroupStore from "../../../stores/GroupStore";
|
||||||
|
|
||||||
export default createReactClass({
|
export default createReactClass({
|
||||||
displayName: 'CreateRoomDialog',
|
displayName: 'CreateRoomDialog',
|
||||||
|
@ -70,6 +72,10 @@ export default createReactClass({
|
||||||
opts.encryption = this.state.isEncrypted;
|
opts.encryption = this.state.isEncrypted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TagOrderStore.getSelectedPrototypeTag()) {
|
||||||
|
opts.associatedWithCommunity = TagOrderStore.getSelectedPrototypeTag();
|
||||||
|
}
|
||||||
|
|
||||||
return opts;
|
return opts;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -212,7 +218,12 @@ export default createReactClass({
|
||||||
</React.Fragment>;
|
</React.Fragment>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = this.state.isPublic ? _t('Create a public room') : _t('Create a private room');
|
let title = this.state.isPublic ? _t('Create a public room') : _t('Create a private room');
|
||||||
|
if (TagOrderStore.getSelectedPrototypeTag()) {
|
||||||
|
const summary = GroupStore.getSummary(TagOrderStore.getSelectedPrototypeTag());
|
||||||
|
const name = summary?.profile?.name || TagOrderStore.getSelectedPrototypeTag();
|
||||||
|
title = _t("Create a room in %(communityName)s", {communityName: name});
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<BaseDialog className="mx_CreateRoomDialog" onFinished={this.props.onFinished}
|
<BaseDialog className="mx_CreateRoomDialog" onFinished={this.props.onFinished}
|
||||||
title={title}
|
title={title}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import * as Rooms from "./Rooms";
|
||||||
import DMRoomMap from "./utils/DMRoomMap";
|
import DMRoomMap from "./utils/DMRoomMap";
|
||||||
import {getAddressType} from "./UserAddress";
|
import {getAddressType} from "./UserAddress";
|
||||||
import { getE2EEWellKnown } from "./utils/WellKnownUtils";
|
import { getE2EEWellKnown } from "./utils/WellKnownUtils";
|
||||||
|
import GroupStore from "./stores/GroupStore";
|
||||||
|
|
||||||
// we define a number of interfaces which take their names from the js-sdk
|
// we define a number of interfaces which take their names from the js-sdk
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
@ -79,6 +80,7 @@ interface IOpts {
|
||||||
encryption?: boolean;
|
encryption?: boolean;
|
||||||
inlineErrors?: boolean;
|
inlineErrors?: boolean;
|
||||||
andView?: boolean;
|
andView?: boolean;
|
||||||
|
associatedWithCommunity?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,6 +183,10 @@ export default function createRoom(opts: IOpts): Promise<string | null> {
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
}).then(() => {
|
||||||
|
if (opts.associatedWithCommunity) {
|
||||||
|
return GroupStore.addRoomToGroup(opts.associatedWithCommunity, roomId, false);
|
||||||
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
// NB createRoom doesn't block on the client seeing the echo that the
|
// NB createRoom doesn't block on the client seeing the echo that the
|
||||||
// room has been created, so we race here with the client knowing that
|
// room has been created, so we race here with the client knowing that
|
||||||
|
|
|
@ -1643,6 +1643,7 @@
|
||||||
"Enable end-to-end encryption": "Enable end-to-end encryption",
|
"Enable end-to-end encryption": "Enable end-to-end encryption",
|
||||||
"Create a public room": "Create a public room",
|
"Create a public room": "Create a public room",
|
||||||
"Create a private room": "Create a private room",
|
"Create a private room": "Create a private room",
|
||||||
|
"Create a room in %(communityName)s": "Create a room in %(communityName)s",
|
||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"Topic (optional)": "Topic (optional)",
|
"Topic (optional)": "Topic (optional)",
|
||||||
"Make this room public": "Make this room public",
|
"Make this room public": "Make this room public",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue