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.jsx21
1 files changed, 16 insertions, 5 deletions
diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx
index 2e0769cc4..24fa79ca6 100644
--- a/web/react/stores/socket_store.jsx
+++ b/web/react/stores/socket_store.jsx
@@ -59,13 +59,14 @@ class SocketStoreClass extends EventEmitter {
conn.onopen = () => {
if (this.failCount > 0) {
console.log('websocket re-established connection'); //eslint-disable-line no-console
+
+ if (ErrorStore.getLastError()) {
+ ErrorStore.storeLastError(null);
+ ErrorStore.emitChange();
+ }
}
this.failCount = 0;
- if (ErrorStore.getLastError()) {
- ErrorStore.storeLastError(null);
- ErrorStore.emitChange();
- }
};
conn.onclose = () => {
@@ -135,6 +136,10 @@ class SocketStoreClass extends EventEmitter {
handleChannelViewedEvent(msg);
break;
+ case SocketEvents.PREFERENCE_CHANGED:
+ handlePreferenceChangedEvent(msg);
+ break;
+
default:
}
}
@@ -163,7 +168,7 @@ function handleNewPostEvent(msg) {
}
// Send desktop notification
- if (UserStore.getCurrentId() !== msg.user_id || post.props.from_webhook === 'true') {
+ if ((UserStore.getCurrentId() !== msg.user_id || post.props.from_webhook === 'true') && !Utils.isSystemMessage(post)) {
const msgProps = msg.props;
let mentions = [];
@@ -224,6 +229,7 @@ function handlePostEditEvent(msg) {
// Store post
const post = JSON.parse(msg.props.post);
PostStore.storePost(post);
+ PostStore.emitChange();
// Update channel state
if (ChannelStore.getCurrentId() === msg.channel_id) {
@@ -279,6 +285,11 @@ function handleChannelViewedEvent(msg) {
}
}
+function handlePreferenceChangedEvent(msg) {
+ const preference = JSON.parse(msg.props.preference);
+ EventHelpers.emitPreferenceChangedEvent(preference);
+}
+
var SocketStore = new SocketStoreClass();
/*SocketStore.dispatchToken = AppDispatcher.register((payload) => {