tags can now be added to group topics

This commit is contained in:
or-else
2018-03-28 11:31:51 -07:00
parent 515e27b489
commit 60262291ce
+9 -7
View File
@@ -2089,8 +2089,8 @@
this.props.onCreateTopic(sel, undefined); this.props.onCreateTopic(sel, undefined);
} }
}, },
handleNewGroupSubmit: function(name, dataUrl, priv) { handleNewGroupSubmit: function(name, dataUrl, priv, tags) {
this.props.onCreateTopic(undefined, vcard(name, dataUrl), priv); this.props.onCreateTopic(undefined, vcard(name, dataUrl), priv, tags);
}, },
handleGroupByID: function(topicName) { handleGroupByID: function(topicName) {
this.props.onCreateTopic(topicName); this.props.onCreateTopic(topicName);
@@ -2149,14 +2149,15 @@
handleImageChanged: function(img) { handleImageChanged: function(img) {
this.setState({imageDataUrl: img}); this.setState({imageDataUrl: img});
}, },
handleTagsUpdated: function(tags) { handleTagsChanged: function(tags) {
this.setState({tags: tags}); this.setState({tags: tags});
}, },
handleSubmit: function(e) { handleSubmit: function(e) {
e.preventDefault(); e.preventDefault();
if (this.state.fn && this.state.fn.trim()) { if (this.state.fn && this.state.fn.trim()) {
this.props.onSubmit(this.state.fn.trim(), this.props.onSubmit(this.state.fn.trim(),
this.state.imageDataUrl, this.state.private.trim()); this.state.imageDataUrl, this.state.private.trim(),
this.state.tags);
} }
}, },
render: function() { render: function() {
@@ -2181,8 +2182,9 @@
onImageChanged={this.handleImageChanged} /> onImageChanged={this.handleImageChanged} />
</div> </div>
<TagManager <TagManager
tags={this.state.tags} tags={[]}
activated={true} activated={true}
onTagsChanged={this.handleTagsChanged}
title="Optional tags (search and discovery)" /> title="Optional tags (search and discovery)" />
<div className="dialog-buttons"> <div className="dialog-buttons">
<button className={submitClasses}>Create</button> <button className={submitClasses}>Create</button>
@@ -3887,13 +3889,13 @@
this.setState({sidePanelSelected: 'new-topic'}); this.setState({sidePanelSelected: 'new-topic'});
}, },
// Create of a new topic. New P2P topic requires peer's name. // Create of a new topic. New P2P topic requires peer's name.
handleNewTopicRequest: function(peerName, pub, priv) { handleNewTopicRequest: function(peerName, pub, priv, tags) {
var instance = this; var instance = this;
var topic = peerName ? Tinode.newTopicWith(peerName) : Tinode.newTopic(); var topic = peerName ? Tinode.newTopicWith(peerName) : Tinode.newTopic();
var query = topic.startMetaQuery().withDesc().withSub().withData(); var query = topic.startMetaQuery().withDesc().withSub().withData();
var setParams; var setParams;
if (!peerName) { if (!peerName) {
setParams = {desc: {public: pub, private: priv}}; setParams = {desc: {public: pub, private: priv}, tags: tags};
} }
topic.subscribe(query.build(), setParams).then(function() { topic.subscribe(query.build(), setParams).then(function() {