Wire together checkboxes and presets and use new /createRoom api
This commit is contained in:
@@ -18,20 +18,39 @@ limitations under the License.
|
||||
|
||||
var React = require('react');
|
||||
|
||||
var Presets = {
|
||||
PrivateChat: "private_chat",
|
||||
PublicChat: "public_chat",
|
||||
Custom: "custom",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
propTypes: {
|
||||
default_preset: React.PropTypes.string
|
||||
onChange: React.PropTypes.func,
|
||||
default_preset: React.PropTypes.string,
|
||||
preset: React.PropTypes.string
|
||||
},
|
||||
|
||||
Presets: Presets,
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
default_preset: 'private_chat',
|
||||
onChange: function() {},
|
||||
default_preset: Presets.PrivateChat,
|
||||
};
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
preset: this.props.default_preset,
|
||||
preset: this.props.preset || this.props.default_preset,
|
||||
}
|
||||
},
|
||||
|
||||
componentWillReceiveProps: function(new_props) {
|
||||
if (new_props.preset) {
|
||||
this.setState({
|
||||
preset: new_props.preset
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -35,7 +35,15 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
getAlias: function() {
|
||||
return this.state.room_alias;
|
||||
getAliasLocalpart: function() {
|
||||
var room_alias = this.state.room_alias;
|
||||
|
||||
if (room_alias) {
|
||||
if (room_alias.startsWith("#") && room_alias.endsWith("example.com")) {
|
||||
room_alias = room_alias.slice(1, -":example.com".length);
|
||||
}
|
||||
}
|
||||
|
||||
return room_alias;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user