You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
Small refactor to handle Direct Message chat as well as multi invite chat
This commit is contained in:
@@ -70,7 +70,7 @@ module.exports = React.createClass({
|
|||||||
this._updateUserList();
|
this._updateUserList();
|
||||||
},
|
},
|
||||||
|
|
||||||
onStartChat: function() {
|
onButtonClick: function() {
|
||||||
var addr;
|
var addr;
|
||||||
|
|
||||||
// Either an address tile was created, or text input is being used
|
// Either an address tile was created, or text input is being used
|
||||||
@@ -78,8 +78,8 @@ module.exports = React.createClass({
|
|||||||
addr = this.state.inviteList[0];
|
addr = this.state.inviteList[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the addr is a valid type
|
if (this.state.inviteList.length === 1 && Invite.getAddressType(addr) === "mx" && !this.props.roomId) {
|
||||||
if (Invite.getAddressType(addr) === "mx") {
|
// Direct Message chat
|
||||||
var room = this._getDirectMessageRoom(addr);
|
var room = this._getDirectMessageRoom(addr);
|
||||||
if (room) {
|
if (room) {
|
||||||
// A Direct Message room already exists for this user and you
|
// A Direct Message room already exists for this user and you
|
||||||
@@ -92,11 +92,9 @@ module.exports = React.createClass({
|
|||||||
} else {
|
} else {
|
||||||
this._startChat(addr);
|
this._startChat(addr);
|
||||||
}
|
}
|
||||||
} else if (Invite.getAddressType(addr) === "email") {
|
|
||||||
this._startChat(addr);
|
|
||||||
} else {
|
} else {
|
||||||
// Nothing to do, so focus back on the textinput
|
// Multi invite chat
|
||||||
this.refs.textinput.focus();
|
this._startChat(addr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -350,7 +348,7 @@ module.exports = React.createClass({
|
|||||||
{ addressSelector }
|
{ addressSelector }
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_Dialog_buttons">
|
<div className="mx_Dialog_buttons">
|
||||||
<button className="mx_Dialog_primary" onClick={this.onStartChat}>
|
<button className="mx_Dialog_primary" onClick={this.onButtonClick}>
|
||||||
{this.props.button}
|
{this.props.button}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user