bug fix: correct display of online status in MessagesView
This commit is contained in:
+18
-4
@@ -1083,7 +1083,8 @@
|
|||||||
<ContactsView
|
<ContactsView
|
||||||
topicSelected={this.props.topicSelected}
|
topicSelected={this.props.topicSelected}
|
||||||
showContextMenu={this.props.showContextMenu}
|
showContextMenu={this.props.showContextMenu}
|
||||||
onTopicSelected={this.props.onTopicSelected} /> :
|
onTopicSelected={this.props.onTopicSelected}
|
||||||
|
onOnlineChange={this.props.onOnlineChange} /> :
|
||||||
|
|
||||||
this.props.state === 'new-topic' ?
|
this.props.state === 'new-topic' ?
|
||||||
<NewTopicView
|
<NewTopicView
|
||||||
@@ -1333,7 +1334,12 @@
|
|||||||
},
|
},
|
||||||
// Reactions to updates to the contact list.
|
// Reactions to updates to the contact list.
|
||||||
tnMeContactUpdate: function(what, cont) {
|
tnMeContactUpdate: function(what, cont) {
|
||||||
if (what === "on" || what === "off" || what === "read") {
|
if (what === "on" || what === "off") {
|
||||||
|
this.resetContactList();
|
||||||
|
if (this.props.topicSelected === cont.topic) {
|
||||||
|
this.props.onOnlineChange(what === "on");
|
||||||
|
}
|
||||||
|
} else if (what === "read") {
|
||||||
this.resetContactList();
|
this.resetContactList();
|
||||||
} else if (what === "msg") {
|
} else if (what === "msg") {
|
||||||
// New message received
|
// New message received
|
||||||
@@ -1356,7 +1362,7 @@
|
|||||||
} else {
|
} else {
|
||||||
// TODO(gene): handle other types of notifications:
|
// TODO(gene): handle other types of notifications:
|
||||||
// * ua -- user agent changes (may display a pictogram for mobile/desktop)
|
// * ua -- user agent changes (may display a pictogram for mobile/desktop)
|
||||||
// * upd -- topic 'public' updated (fetch new public and refresh)
|
// * upd -- topic 'public' updated
|
||||||
// * del -- messages deleted (hard or soft) -- reset pill counter
|
// * del -- messages deleted (hard or soft) -- reset pill counter
|
||||||
console.log("changed (not updating for it): " + what + " in: " + cont.topic);
|
console.log("changed (not updating for it): " + what + " in: " + cont.topic);
|
||||||
}
|
}
|
||||||
@@ -2644,7 +2650,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var avatar = this.state.avatar || true;
|
var avatar = this.state.avatar || true;
|
||||||
var online = cont && cont.online ? "online" + (this.state.typingIndicator ? " typing" : "") : "offline";
|
var online = this.props.online ? "online" + (this.state.typingIndicator ? " typing" : "") : "offline";
|
||||||
|
|
||||||
component = (
|
component = (
|
||||||
<div id="topic-view" className={this.props.hideSelf ? 'nodisplay' : null}>
|
<div id="topic-view" className={this.props.hideSelf ? 'nodisplay' : null}>
|
||||||
@@ -2831,6 +2837,7 @@
|
|||||||
errorLevel: null,
|
errorLevel: null,
|
||||||
liveConnection: navigator.onLine,
|
liveConnection: navigator.onLine,
|
||||||
topicSelected: '',
|
topicSelected: '',
|
||||||
|
topicSelectedOnline: false,
|
||||||
loginDisabled: false,
|
loginDisabled: false,
|
||||||
displayMobile: (window.innerWidth <= MEDIA_BREAKPOINT),
|
displayMobile: (window.innerWidth <= MEDIA_BREAKPOINT),
|
||||||
showInfoPanel: false,
|
showInfoPanel: false,
|
||||||
@@ -3038,6 +3045,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleTopicSelectedOnline: function(online) {
|
||||||
|
this.setState({topicSelectedOnline: online});
|
||||||
|
},
|
||||||
|
|
||||||
// In mobile view user requested to show sidepanel
|
// In mobile view user requested to show sidepanel
|
||||||
handleHideMessagesView: function() {
|
handleHideMessagesView: function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -3321,6 +3333,7 @@
|
|||||||
onCreateTopic={this.handleNewTopicRequest}
|
onCreateTopic={this.handleNewTopicRequest}
|
||||||
onNewTopic={this.handleNewTopic}
|
onNewTopic={this.handleNewTopic}
|
||||||
onCancel={this.handleSidepanelCancel}
|
onCancel={this.handleSidepanelCancel}
|
||||||
|
onOnlineChange={this.handleTopicSelectedOnline}
|
||||||
|
|
||||||
onInitFind={this.tnInitFind}
|
onInitFind={this.tnInitFind}
|
||||||
contactsSearchQuery={this.state.contactsSearchQuery}
|
contactsSearchQuery={this.state.contactsSearchQuery}
|
||||||
@@ -3331,6 +3344,7 @@
|
|||||||
|
|
||||||
<MessagesView
|
<MessagesView
|
||||||
connected={this.state.connected}
|
connected={this.state.connected}
|
||||||
|
online={this.state.topicSelectedOnline}
|
||||||
displayMobile={this.state.displayMobile}
|
displayMobile={this.state.displayMobile}
|
||||||
hideSelf={this.state.displayMobile &&
|
hideSelf={this.state.displayMobile &&
|
||||||
(this.state.mobilePanel !== 'topic-view' || this.state.showInfoPanel)}
|
(this.state.mobilePanel !== 'topic-view' || this.state.showInfoPanel)}
|
||||||
|
|||||||
Reference in New Issue
Block a user