fix up Start Chat behaviour as per Amandine's feedback

This commit is contained in:
Matthew Hodgson 2016-01-21 00:16:10 +00:00
parent 35c141cda9
commit deca90d0a7
5 changed files with 23 additions and 12 deletions

View file

@ -375,7 +375,7 @@ module.exports = React.createClass({
dis.dispatch({
action: 'view_room',
room_id: res.room_id,
show_settings: true,
// show_settings: true,
});
}, function(err) {
modal.close();

View file

@ -457,6 +457,15 @@ module.exports = React.createClass({
}
this._updateTabCompleteList(this.state.room);
// XXX: EVIL HACK to autofocus inviting on empty rooms.
// We use the setTimeout to avoid racing with focus_composer.
if (this.state.room && this.state.room.getJoinedMembers().length == 1) {
var inviteBox = document.getElementById("mx_SearchableEntityList_query");
setTimeout(function() {
inviteBox.focus();
}, 50);
}
},
_updateTabCompleteList: function(room) {

View file

@ -190,7 +190,7 @@ module.exports = React.createClass({
var can_set_room_topic = current_user_level >= room_topic_level;
var placeholderName = "Unnamed Room";
if (this.state.defaultName && this.state.defaultName !== '?') {
if (this.state.defaultName && this.state.defaultName !== 'Empty room') {
placeholderName += " (" + this.state.defaultName + ")";
}
@ -218,9 +218,19 @@ module.exports = React.createClass({
searchStatus = <div className="mx_RoomHeader_searchStatus">&nbsp;(~{ this.props.searchInfo.searchCount } results)</div>;
}
// XXX: this is a bit inefficient - we could just compare room.name for 'Empty room'...
var members = this.props.room.getJoinedMembers();
var settingsHint = false;
if (members.length === 1 && members[0].userId === MatrixClientPeg.get().credentials.userId) {
var name = this.props.room.currentState.getStateEvents('m.room.name', '');
if (!name || !name.getContent().name) {
settingsHint = true;
}
}
name =
<div className="mx_RoomHeader_name" onClick={this.props.onSettingsClick}>
<div className="mx_RoomHeader_nametext" title={ this.props.room.name }>{ this.props.room.name }</div>
<div className={ "mx_RoomHeader_nametext " + (settingsHint ? "mx_RoomHeader_settingsHint" : "") } title={ this.props.room.name }>{ this.props.room.name }</div>
{ searchStatus }
<div className="mx_RoomHeader_settingsButton" title="Settings">
<TintableSvg src="img/settings.svg" width="12" height="12"/>

View file

@ -43,14 +43,6 @@ module.exports = React.createClass({
onCancelClick: React.PropTypes.func,
},
componentDidMount: function() {
// XXX: dirty hack to gutwrench to focus on the invite box
if (this.props.room.getJoinedMembers().length == 1) {
var inviteBox = document.getElementById("mx_MemberList_invite");
if (inviteBox) setTimeout(function() { inviteBox.focus(); }, 0);
}
},
getInitialState: function() {
// work out the initial color index
var room_color_index = undefined;

View file

@ -96,7 +96,7 @@ var SearchableEntityList = React.createClass({
if (this.props.showInputBox) {
inputBox = (
<form onSubmit={this.onQuerySubmit}>
<input className="mx_SearchableEntityList_query" type="text"
<input className="mx_SearchableEntityList_query" id="mx_SearchableEntityList_query" type="text"
onChange={this.onQueryChanged} value={this.state.query}
placeholder={this.props.searchPlaceholderText} />
</form>