Wire together checkboxes and presets and use new /createRoom api

This commit is contained in:
Erik Johnston
2015-07-16 15:55:46 +01:00
parent c708976635
commit cd26d1323f
5 changed files with 124 additions and 13 deletions
+22 -3
View File
@@ -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
});
}
},
+10 -2
View File
@@ -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;
},
};