summaryrefslogtreecommitdiffstats
path: root/web/react/components/textbox.jsx
diff options
context:
space:
mode:
authorReed Garmsen <rgarmsen2295@gmail.com>2015-07-09 17:49:02 -0700
committerReed Garmsen <rgarmsen2295@gmail.com>2015-07-09 17:49:02 -0700
commit56f369cfd1c8a480a1e70a10564670153dae2ff2 (patch)
tree65815295592c27f763d0844b16abdf42ddd9157e /web/react/components/textbox.jsx
parent80f9ebadeff1f96fe2235e35cc5a1f80afd6dd58 (diff)
downloadchat-56f369cfd1c8a480a1e70a10564670153dae2ff2.tar.gz
chat-56f369cfd1c8a480a1e70a10564670153dae2ff2.tar.bz2
chat-56f369cfd1c8a480a1e70a10564670153dae2ff2.zip
Use the AsyncClient call 'updateLastViewedAt' as a way of checking for inet connectivity immediately after clearning yellow bar after user has typed 5 characters
Diffstat (limited to 'web/react/components/textbox.jsx')
-rw-r--r--web/react/components/textbox.jsx24
1 files changed, 15 insertions, 9 deletions
diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx
index 227d61e3f..db28fe3ab 100644
--- a/web/react/components/textbox.jsx
+++ b/web/react/components/textbox.jsx
@@ -9,6 +9,7 @@ var MsgTyping = require('./msg_typing.jsx');
var MentionList = require('./mention_list.jsx');
var CommandList = require('./command_list.jsx');
var ErrorStore = require('../stores/error_store.jsx');
+var AsyncClient = require('../utils/async_client.jsx');
var utils = require('../utils/utils.jsx');
var Constants = require('../utils/constants.jsx');
@@ -32,7 +33,6 @@ module.exports = React.createClass({
componentDidMount: function() {
PostStore.addAddMentionListener(this._onChange);
ErrorStore.addChangeListener(this._onError);
- //SocketStore.addChangeListener(this._onSocketChange);
this.resize();
this.processMentions();
@@ -53,16 +53,9 @@ module.exports = React.createClass({
this.setState({ connection: " bad-connection" });
}
else {
- console.log("Logged the error correctly");
this.setState({ connection: "" });
}
},
- /*_onSocketChange: function() {
- if (SocketStore.isSocketClosed())
- this.setState({ connection: " bad-connection" });
- else
- this.setState({ connection: "" });
- },*/
componentDidUpdate: function() {
if (this.caret >= 0) {
utils.setCaretPosition(this.refs.message.getDOMNode(), this.caret)
@@ -88,7 +81,7 @@ module.exports = React.createClass({
this.resize();
},
getInitialState: function() {
- return { mentionText: '-1', mentions: [], connection: "" };
+ return { mentionText: '-1', mentions: [], connection: "", numPresses: 0 };
},
updateMentionTab: function(mentionText, excludeList) {
var self = this;
@@ -120,6 +113,19 @@ module.exports = React.createClass({
handleKeyPress: function(e) {
var text = this.refs.message.getDOMNode().value;
+ if (this.state.connection === " bad-connection" && this.state.numPresses > 5) {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECIEVED_ERROR,
+ err: null
+ });
+ this.setState({ numPresses: 0 });
+
+ AsyncClient.updateLastViewedAt();
+ }
+ else if (this.state.connection === " bad-connection") {
+ this.setState({ numPresses: this.state.numPresses + 1 });
+ }
+
if (!this.refs.commands.isEmpty() && text.indexOf("/") == 0 && e.which==13) {
this.refs.commands.addFirstCommand();
e.preventDefault();