a few fixes around contacts discovery
This commit is contained in:
+17
-7
@@ -482,7 +482,7 @@
|
|||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<a href="#" onClick={this.props.onNewTopic}><i className="material-icons">add_circle</i></a>
|
<a href="#" onClick={this.props.onNewTopic}><i className="material-icons">chat</i></a>
|
||||||
|
|
||||||
<a href="#" onClick={this.props.onSettings}><i className="material-icons">settings</i></a>
|
<a href="#" onClick={this.props.onSettings}><i className="material-icons">settings</i></a>
|
||||||
</div>
|
</div>
|
||||||
@@ -756,20 +756,25 @@
|
|||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
tabSelected: "p2p",
|
tabSelected: "p2p",
|
||||||
|
searchQuery: '',
|
||||||
contactSelected: null
|
contactSelected: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
var fnd = Tinode.getFndTopic();
|
var fnd = Tinode.getFndTopic();
|
||||||
fnd.onSubsUpdated = this.fndSubsUpdated;
|
fnd.onSubsUpdated = this.fndSubsUpdated;
|
||||||
fnd.subscribe()
|
fnd.onMetaDesc = this.fndMetaDesc;
|
||||||
.then(function() {
|
fnd.subscribe({get: {sub: {}, desc: {}}});
|
||||||
fnd.getMeta({sub: {}});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
var fnd = Tinode.getFndTopic();
|
var fnd = Tinode.getFndTopic();
|
||||||
fnd.onSubsUpdated = undefined;
|
fnd.onSubsUpdated = undefined;
|
||||||
|
fnd.onMetaDesc = undefined;
|
||||||
|
},
|
||||||
|
fndMetaDesc: function(desc) {
|
||||||
|
if (desc.private) {
|
||||||
|
this.setState({searchQuery: desc.private.toString()});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fndSubsUpdated: function() {
|
fndSubsUpdated: function() {
|
||||||
//console.log(keys);
|
//console.log(keys);
|
||||||
@@ -816,7 +821,9 @@
|
|||||||
{this.state.tabSelected === "grp" ?
|
{this.state.tabSelected === "grp" ?
|
||||||
<NewTopicView.Group onSubmit={this.handleGroupSubmit} /> :
|
<NewTopicView.Group onSubmit={this.handleGroupSubmit} /> :
|
||||||
<div className="flex-column">
|
<div className="flex-column">
|
||||||
<NewTopicView.SearchContacts type="p2p" onSearchContacts={this.props.onSearchContacts} />
|
<NewTopicView.SearchContacts type="p2p"
|
||||||
|
searchQuery={this.state.searchQuery}
|
||||||
|
onSearchContacts={this.props.onSearchContacts} />
|
||||||
<NewTopicView.ContactsList onContactSelected={this.handleContactSelected} type="p2p" />
|
<NewTopicView.ContactsList onContactSelected={this.handleContactSelected} type="p2p" />
|
||||||
</div>}
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
@@ -871,6 +878,9 @@
|
|||||||
search: ''
|
search: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
componentWillReceiveProps: function(nextProps) {
|
||||||
|
this.setState({search: nextProps.searchQuery});
|
||||||
|
},
|
||||||
handleSearchChange: function(e) {
|
handleSearchChange: function(e) {
|
||||||
this.setState({search: e.target.value});
|
this.setState({search: e.target.value});
|
||||||
},
|
},
|
||||||
@@ -1520,7 +1530,7 @@
|
|||||||
handleSearchContacts: function(query) {
|
handleSearchContacts: function(query) {
|
||||||
var find = Tinode.getFndTopic();
|
var find = Tinode.getFndTopic();
|
||||||
find.setMeta({desc: {private: query}}).then(function() {
|
find.setMeta({desc: {private: query}}).then(function() {
|
||||||
find.getMeta({sub: {}});
|
find.getMeta({sub: {}, desc: {}});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleDialogCancel: function() {
|
handleDialogCancel: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user