switch account tags from "me" to "fnd"

This commit is contained in:
or-else
2018-05-15 10:32:32 -07:00
parent 77479a3e2d
commit 9d128e505f
+13 -6
View File
@@ -1531,21 +1531,28 @@
componentWillMount: function() { componentWillMount: function() {
var me = Tinode.getMeTopic(); var me = Tinode.getMeTopic();
var defacs = me.getDefaultAccess(); var defacs = me.getDefaultAccess();
var fnd = Tinode.getFndTopic();
this.setState({ this.setState({
fullName: me.public ? me.public.fn : undefined, fullName: me.public ? me.public.fn : undefined,
avatar: makeImageUrl(me.public ? me.public.photo : null), avatar: makeImageUrl(me.public ? me.public.photo : null),
address: Tinode.getCurrentUserID(), address: Tinode.getCurrentUserID(),
auth: defacs.auth, auth: defacs.auth,
anon: defacs.anon, anon: defacs.anon,
tags: me.tags(), tags: fnd.tags(),
previousOnTags: me.onTagsUpdated previousOnTags: fnd.onTagsUpdated
}); });
me.onTagsUpdated = this.tnNewTags; fnd.onTagsUpdated = this.tnNewTags;
if (!fnd.isSubscribed()) {
var instance = this;
fnd.subscribe(fnd.startMetaQuery().withLaterDesc().withTags().build()).catch(function(err){
instance.props.onError(err.message, "err");
});
}
}, },
componentWillUnmount: function() { componentWillUnmount: function() {
var me = Tinode.getMeTopic(); var fnd = Tinode.getFndTopic();
me.onTagsUpdated = this.state.previousOnTags; fnd.onTagsUpdated = this.state.previousOnTags;
}, },
tnNewTags: function(tags) { tnNewTags: function(tags) {
@@ -4188,7 +4195,7 @@
handleUpdateAccountTagsRequest: function(tags) { handleUpdateAccountTagsRequest: function(tags) {
var instance = this; var instance = this;
Tinode.getMeTopic().setMeta({tags: tags}) Tinode.getFndTopic().setMeta({tags: tags})
.catch(function(err) { .catch(function(err) {
instance.handleError(err.message, "err"); instance.handleError(err.message, "err");
}); });