prevent premature subscription
This commit is contained in:
@@ -111,8 +111,8 @@ class MessagesView extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topic && !topic.isSubscribed() && this.props.tinode.isAuthenticated() &&
|
if (topic && !topic.isSubscribed() && this.props.ready &&
|
||||||
((!prevProps.connected && this.props.connected) || (this.state.topic != prevState.topic))) {
|
((this.state.topic != prevState.topic) || !prevProps.ready)) {
|
||||||
// Don't request the tags. They are useless unless the user
|
// Don't request the tags. They are useless unless the user
|
||||||
// is the owner and is editing the topic.
|
// is the owner and is editing the topic.
|
||||||
let getQuery = topic.startMetaQuery().withLaterDesc().withLaterSub();
|
let getQuery = topic.startMetaQuery().withLaterDesc().withLaterSub();
|
||||||
@@ -356,7 +356,8 @@ class MessagesView extends React.Component {
|
|||||||
newState.scrollPosition = 0;
|
newState.scrollPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aknowledge messages except own messages.
|
// Aknowledge messages except own messages. They are
|
||||||
|
// automatically assumed to be read and recived.
|
||||||
const status = topic.msgStatus(msg);
|
const status = topic.msgStatus(msg);
|
||||||
if (status >= Tinode.MESSAGE_STATUS_SENT && msg.from != this.props.myUserId) {
|
if (status >= Tinode.MESSAGE_STATUS_SENT && msg.from != this.props.myUserId) {
|
||||||
this.props.readTimerHandler(() => {
|
this.props.readTimerHandler(() => {
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
connected: false,
|
connected: false,
|
||||||
|
// Connected and subscribed to 'me'
|
||||||
|
ready: false,
|
||||||
transport: settings.transport || null,
|
transport: settings.transport || null,
|
||||||
serverAddress: settings.serverAddress || detectServerAddress(),
|
serverAddress: settings.serverAddress || detectServerAddress(),
|
||||||
serverVersion: "no connection",
|
serverVersion: "no connection",
|
||||||
@@ -410,6 +412,7 @@ class TinodeWeb extends React.Component {
|
|||||||
handleDisconnect(err) {
|
handleDisconnect(err) {
|
||||||
this.setState({
|
this.setState({
|
||||||
connected: false,
|
connected: false,
|
||||||
|
ready: false,
|
||||||
topicSelectedOnline: false,
|
topicSelectedOnline: false,
|
||||||
dialogSelected: null,
|
dialogSelected: null,
|
||||||
errorText: err && err.message ? err.message : "Disconnected",
|
errorText: err && err.message ? err.message : "Disconnected",
|
||||||
@@ -594,6 +597,11 @@ class TinodeWeb extends React.Component {
|
|||||||
const newState = {
|
const newState = {
|
||||||
chatList: []
|
chatList: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!this.state.ready) {
|
||||||
|
newState.ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.tinode.getMeTopic().contacts((c) => {
|
this.tinode.getMeTopic().contacts((c) => {
|
||||||
newState.chatList.push(c);
|
newState.chatList.push(c);
|
||||||
if (this.state.topicSelected == c.topic) {
|
if (this.state.topicSelected == c.topic) {
|
||||||
@@ -1265,6 +1273,7 @@ class TinodeWeb extends React.Component {
|
|||||||
<MessagesView
|
<MessagesView
|
||||||
tinode={this.tinode}
|
tinode={this.tinode}
|
||||||
connected={this.state.connected}
|
connected={this.state.connected}
|
||||||
|
ready={this.state.ready}
|
||||||
online={this.state.topicSelectedOnline}
|
online={this.state.topicSelectedOnline}
|
||||||
acs={this.state.topicSelectedAcs}
|
acs={this.state.topicSelectedAcs}
|
||||||
displayMobile={this.state.displayMobile}
|
displayMobile={this.state.displayMobile}
|
||||||
|
|||||||
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user