s/inviteList/userList/
This commit is contained in:
parent
fa660c8211
commit
bbcf7e1d9b
1 changed files with 22 additions and 22 deletions
|
@ -57,7 +57,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
// List of UserAddressType objects representing
|
// List of UserAddressType objects representing
|
||||||
// the list of addresses we're going to invite
|
// the list of addresses we're going to invite
|
||||||
inviteList: [],
|
userList: [],
|
||||||
|
|
||||||
// Whether a search is ongoing
|
// Whether a search is ongoing
|
||||||
busy: false,
|
busy: false,
|
||||||
|
@ -82,14 +82,14 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onButtonClick: function() {
|
onButtonClick: function() {
|
||||||
let inviteList = this.state.inviteList.slice();
|
let userList = this.state.userList.slice();
|
||||||
// Check the text input field to see if user has an unconverted address
|
// Check the text input field to see if user has an unconverted address
|
||||||
// If there is and it's valid add it to the local inviteList
|
// If there is and it's valid add it to the local userList
|
||||||
if (this.refs.textinput.value !== '') {
|
if (this.refs.textinput.value !== '') {
|
||||||
inviteList = this._addInputToList();
|
userList = this._addInputToList();
|
||||||
if (inviteList === null) return;
|
if (userList === null) return;
|
||||||
}
|
}
|
||||||
this.props.onFinished(true, inviteList);
|
this.props.onFinished(true, userList);
|
||||||
},
|
},
|
||||||
|
|
||||||
onCancel: function() {
|
onCancel: function() {
|
||||||
|
@ -113,10 +113,10 @@ module.exports = React.createClass({
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this.addressSelector) this.addressSelector.chooseSelection();
|
if (this.addressSelector) this.addressSelector.chooseSelection();
|
||||||
} else if (this.refs.textinput.value.length === 0 && this.state.inviteList.length && e.keyCode === 8) { // backspace
|
} else if (this.refs.textinput.value.length === 0 && this.state.userList.length && e.keyCode === 8) { // backspace
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.onDismissed(this.state.inviteList.length - 1)();
|
this.onDismissed(this.state.userList.length - 1)();
|
||||||
} else if (e.keyCode === 13) { // enter
|
} else if (e.keyCode === 13) { // enter
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -158,10 +158,10 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
onDismissed: function(index) {
|
onDismissed: function(index) {
|
||||||
return () => {
|
return () => {
|
||||||
const inviteList = this.state.inviteList.slice();
|
const userList = this.state.userList.slice();
|
||||||
inviteList.splice(index, 1);
|
userList.splice(index, 1);
|
||||||
this.setState({
|
this.setState({
|
||||||
inviteList: inviteList,
|
userList: userList,
|
||||||
queryList: [],
|
queryList: [],
|
||||||
query: "",
|
query: "",
|
||||||
});
|
});
|
||||||
|
@ -176,10 +176,10 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelected: function(index) {
|
onSelected: function(index) {
|
||||||
const inviteList = this.state.inviteList.slice();
|
const userList = this.state.userList.slice();
|
||||||
inviteList.push(this.state.queryList[index]);
|
userList.push(this.state.queryList[index]);
|
||||||
this.setState({
|
this.setState({
|
||||||
inviteList: inviteList,
|
userList: userList,
|
||||||
queryList: [],
|
queryList: [],
|
||||||
query: "",
|
query: "",
|
||||||
});
|
});
|
||||||
|
@ -304,15 +304,15 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const inviteList = this.state.inviteList.slice();
|
const userList = this.state.userList.slice();
|
||||||
inviteList.push(addrObj);
|
userList.push(addrObj);
|
||||||
this.setState({
|
this.setState({
|
||||||
inviteList: inviteList,
|
userList: userList,
|
||||||
queryList: [],
|
queryList: [],
|
||||||
query: "",
|
query: "",
|
||||||
});
|
});
|
||||||
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
||||||
return inviteList;
|
return userList;
|
||||||
},
|
},
|
||||||
|
|
||||||
_lookupThreepid: function(medium, address) {
|
_lookupThreepid: function(medium, address) {
|
||||||
|
@ -357,18 +357,18 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
const query = [];
|
const query = [];
|
||||||
// create the invite list
|
// create the invite list
|
||||||
if (this.state.inviteList.length > 0) {
|
if (this.state.userList.length > 0) {
|
||||||
const AddressTile = sdk.getComponent("elements.AddressTile");
|
const AddressTile = sdk.getComponent("elements.AddressTile");
|
||||||
for (let i = 0; i < this.state.inviteList.length; i++) {
|
for (let i = 0; i < this.state.userList.length; i++) {
|
||||||
query.push(
|
query.push(
|
||||||
<AddressTile key={i} address={this.state.inviteList[i]} canDismiss={true} onDismissed={ this.onDismissed(i) } />,
|
<AddressTile key={i} address={this.state.userList[i]} canDismiss={true} onDismissed={ this.onDismissed(i) } />,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the query at the end
|
// Add the query at the end
|
||||||
query.push(
|
query.push(
|
||||||
<textarea key={this.state.inviteList.length}
|
<textarea key={this.state.userList.length}
|
||||||
rows="1"
|
rows="1"
|
||||||
id="textinput"
|
id="textinput"
|
||||||
ref="textinput"
|
ref="textinput"
|
||||||
|
|
Loading…
Reference in a new issue