From d538377b826aebd5a3b920beac0ed936a1ee9000 Mon Sep 17 00:00:00 2001 From: wmwragg Date: Mon, 12 Sep 2016 14:48:00 +0100 Subject: [PATCH] Added an inviteList state to hold all the users to invite, but currently pretend it only has one users (the first one) --- .../views/dialogs/ChatInviteDialog.js | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index f0eb1c4e63..6d4cf21f70 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -55,8 +55,7 @@ module.exports = React.createClass({ getInitialState: function() { return { - user: null, - addressSelected: false, + inviteList: [], queryList: [], }; }, @@ -73,8 +72,8 @@ module.exports = React.createClass({ var addr; // Either an address tile was created, or text input is being used - if (this.state.user) { - addr = this.state.user.userId; + if (this.state.inviteList[0]) { + addr = this.state.inviteList[0].userId; } else { addr = this.refs.textinput.value; } @@ -141,8 +140,7 @@ module.exports = React.createClass({ onDismissed: function() { this.setState({ - user: null, - addressSelected: false, + inviteList: [], queryList: [], }); }, @@ -150,18 +148,15 @@ module.exports = React.createClass({ onClick: function(index) { var self = this; return function() { - self.setState({ - user: self.state.queryList[index], - addressSelected: true, - queryList: [], - }); + self.onSelected(index); }; }, onSelected: function(index) { + var inviteList = this.state.inviteList.slice(); + inviteList.push(this.state.queryList[index]); this.setState({ - user: this.state.queryList[index], - addressSelected: true, + inviteList: inviteList, queryList: [], }); }, @@ -237,10 +232,10 @@ module.exports = React.createClass({ this.scrollElement = null; var query; - if (this.state.addressSelected) { + if (this.state.inviteList.length > 0) { var AddressTile = sdk.getComponent("elements.AddressTile"); query = ( - + ); } else { query = (