diff options
author | Corey Hulen <corey@hulen.com> | 2015-12-04 11:30:50 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-12-04 11:30:50 -0800 |
commit | 1bee1e06e4d0110db274c076860fa97f76471ddb (patch) | |
tree | 8f971b54319ae90246ad13905851df545bbb7b89 /web/react/components/posts_view.jsx | |
parent | 1d67f26664f8cf98f52433ef8b081b6fb485eadb (diff) | |
parent | 14d1ec5191867174837e15f616ad3fc1dc8e0dae (diff) | |
download | chat-1bee1e06e4d0110db274c076860fa97f76471ddb.tar.gz chat-1bee1e06e4d0110db274c076860fa97f76471ddb.tar.bz2 chat-1bee1e06e4d0110db274c076860fa97f76471ddb.zip |
Merge pull request #1613 from florianorben/PLT-1326
PLT-1326: Enable channel posts of type join or leave not trigger unread notifications
Diffstat (limited to 'web/react/components/posts_view.jsx')
-rw-r--r-- | web/react/components/posts_view.jsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/web/react/components/posts_view.jsx b/web/react/components/posts_view.jsx index d0eee5a23..740ce04f6 100644 --- a/web/react/components/posts_view.jsx +++ b/web/react/components/posts_view.jsx @@ -87,6 +87,7 @@ export default class PostsView extends React.Component { const post = posts[order[i]]; const parentPost = posts[post.parent_id]; const prevPost = posts[order[i + 1]]; + const postUserId = Utils.isSystemMessage(post) ? '' : post.user_id; // If the post is a comment whose parent has been deleted, don't add it to the list. if (parentPost && parentPost.state === Constants.POST_DELETED) { @@ -102,6 +103,7 @@ export default class PostsView extends React.Component { const prevPostIsComment = Utils.isComment(prevPost); const postFromWebhook = Boolean(post.props && post.props.from_webhook); const prevPostFromWebhook = Boolean(prevPost.props && prevPost.props.from_webhook); + const prevPostUserId = Utils.isSystemMessage(prevPost) ? '' : prevPostUserId; let prevWebhookName = ''; if (prevPost.props && prevPost.props.override_username) { prevWebhookName = prevPost.props.override_username; @@ -116,7 +118,7 @@ export default class PostsView extends React.Component { // the previous post was made within 5 minutes of the current post, // the previous post and current post are both from webhooks or both not, // the previous post and current post have the same webhook usernames - if (prevPost.user_id === post.user_id && + if (prevPostUserId === postUserId && post.create_at - prevPost.create_at <= 1000 * 60 * 5 && postFromWebhook === prevPostFromWebhook && prevWebhookName === curWebhookName) { @@ -144,7 +146,7 @@ export default class PostsView extends React.Component { // the current post is not a comment, // the previous post and current post are both from webhooks or both not, // the previous post and current post have the same webhook usernames - if (prevPost.user_id === post.user_id && + if (prevPostUserId === postUserId && !prevPostIsComment && !postIsComment && postFromWebhook === prevPostFromWebhook && @@ -191,7 +193,7 @@ export default class PostsView extends React.Component { ); } - if (post.user_id !== userId && + if (postUserId !== userId && this.props.messageSeparatorTime !== 0 && post.create_at > this.props.messageSeparatorTime && !renderedLastViewed) { |