summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-09 14:41:23 -0500
committerGeorge Goldberg <george@gberg.me>2017-03-09 19:41:23 +0000
commit270ac113654d17cabf4a92d48de4ca4a9de65c46 (patch)
treeff04110b837f24000264dcb86e2383ea892a6bb6 /webapp
parent9c13863f484e9741adf4179cb6b95ee4af8ec343 (diff)
downloadchat-270ac113654d17cabf4a92d48de4ca4a9de65c46.tar.gz
chat-270ac113654d17cabf4a92d48de4ca4a9de65c46.tar.bz2
chat-270ac113654d17cabf4a92d48de4ca4a9de65c46.zip
Fix posts from your own webhook not showing as unread until refresh (#5703)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/stores/channel_store.jsx4
-rw-r--r--webapp/utils/post_utils.jsx4
2 files changed, 6 insertions, 2 deletions
diff --git a/webapp/stores/channel_store.jsx b/webapp/stores/channel_store.jsx
index f303b0190..41fa76b39 100644
--- a/webapp/stores/channel_store.jsx
+++ b/webapp/stores/channel_store.jsx
@@ -10,7 +10,7 @@ import UserStore from 'stores/user_store.jsx';
var ChannelUtils;
var Utils;
import {ActionTypes, Constants} from 'utils/constants.jsx';
-import {isSystemMessage} from 'utils/post_utils.jsx';
+import {isSystemMessage, isFromWebhook} from 'utils/post_utils.jsx';
const NotificationPrefs = Constants.NotificationPrefs;
const CHANGE_EVENT = 'change';
@@ -521,7 +521,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
return;
}
- if (action.post.user_id === UserStore.getCurrentId() && !isSystemMessage(action.post)) {
+ if (action.post.user_id === UserStore.getCurrentId() && !isSystemMessage(action.post) && !isFromWebhook(action.post)) {
return;
}
diff --git a/webapp/utils/post_utils.jsx b/webapp/utils/post_utils.jsx
index 0b908c55b..1f2021e4a 100644
--- a/webapp/utils/post_utils.jsx
+++ b/webapp/utils/post_utils.jsx
@@ -12,6 +12,10 @@ export function isSystemMessage(post) {
return post.type && (post.type.lastIndexOf(Constants.SYSTEM_MESSAGE_PREFIX) === 0);
}
+export function isFromWebhook(post) {
+ return post.props && post.props.from_webhook === 'true';
+}
+
export function isPostOwner(post) {
return UserStore.getCurrentId() === post.user_id;
}