buf fix: missing fnd result after viewing account info

This commit is contained in:
or-else
2019-03-01 13:26:10 +03:00
parent d13b24263e
commit a9ba11a0ff
5 changed files with 32 additions and 14 deletions
+17 -8
View File
@@ -1,3 +1,4 @@
// Edit account parameters. // Edit account parameters.
import React from 'react'; import React from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
@@ -15,14 +16,15 @@ export default class EditAccountView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let me = this.props.tinode.getMeTopic(); const me = this.props.tinode.getMeTopic();
let defacs = me.getDefaultAccess(); const defacs = me ? me.getDefaultAccess() : null;
let fnd = this.props.tinode.getFndTopic(); const fnd = this.props.tinode.getFndTopic();
this.state = { this.state = {
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),
auth: defacs ? defacs.auth : null, auth: defacs ? defacs.auth : null,
anon: defacs ? defacs.anon : null, anon: defacs ? defacs.anon : null,
fndSubscribed: false,
tags: fnd.tags(), tags: fnd.tags(),
showPermissionEditorFor: undefined, showPermissionEditorFor: undefined,
previousOnTags: fnd.onTagsUpdated previousOnTags: fnd.onTagsUpdated
@@ -40,18 +42,25 @@ export default class EditAccountView extends React.Component {
} }
componentDidMount() { componentDidMount() {
let fnd = this.props.tinode.getFndTopic(); const fnd = this.props.tinode.getFndTopic();
fnd.onTagsUpdated = this.tnNewTags; fnd.onTagsUpdated = this.tnNewTags;
if (!fnd.isSubscribed()) { if (!fnd.isSubscribed()) {
fnd.subscribe(fnd.startMetaQuery().withLaterDesc().withTags().build()).catch((err) => { fnd.subscribe(fnd.startMetaQuery().withTags().build())
this.props.onError(err.message, 'err'); .then((ctrl) => {
}); this.setState({fndSubscribed: true});
})
.catch((err) => {
this.props.onError(err.message, 'err');
});
} }
} }
componentWillUnmount() { componentWillUnmount() {
var fnd = this.props.tinode.getFndTopic(); const fnd = this.props.tinode.getFndTopic();
fnd.onTagsUpdated = this.state.previousOnTags; fnd.onTagsUpdated = this.state.previousOnTags;
if (fnd.isSubscribed() && this.state.fndSubscribed) {
fnd.leave();
}
} }
tnNewTags(tags) { tnNewTags(tags) {
+12 -3
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long