summaryrefslogtreecommitdiffstats
path: root/web/react/stores/socket_store.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/stores/socket_store.jsx')
-rw-r--r--web/react/stores/socket_store.jsx20
1 files changed, 17 insertions, 3 deletions
diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx
index e1b65fe14..efb57e226 100644
--- a/web/react/stores/socket_store.jsx
+++ b/web/react/stores/socket_store.jsx
@@ -32,6 +32,8 @@ class SocketStoreClass extends EventEmitter {
this.failCount = 0;
+ this.translations = this.getDefaultTranslations();
+
this.initialize();
}
@@ -174,6 +176,18 @@ class SocketStoreClass extends EventEmitter {
this.translations = messages;
}
+ getDefaultTranslations() {
+ return ({
+ socketError: 'Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port.',
+ someone: 'Someone',
+ posted: 'Posted',
+ uploadedImage: ' uploaded an image',
+ uploadedFile: ' uploaded a file',
+ something: ' did something new',
+ wrote: ' wrote: '
+ });
+ }
+
close() {
if (conn && conn.readyState === WebSocket.OPEN) {
conn.close();
@@ -188,10 +202,10 @@ function handleNewPostEvent(msg, translations) {
// Update channel state
if (ChannelStore.getCurrentId() === msg.channel_id) {
- if (document.hidden) {
- AsyncClient.getChannel(msg.channel_id);
- } else {
+ if (window.isActive) {
AsyncClient.updateLastViewedAt();
+ } else {
+ AsyncClient.getChannel(msg.channel_id);
}
} else if (UserStore.getCurrentId() !== msg.user_id || post.type !== Constants.POST_TYPE_JOIN_LEAVE) {
AsyncClient.getChannel(msg.channel_id);