summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-08-18 17:37:55 -0500
committerCorey Hulen <corey@hulen.com>2016-08-18 14:37:55 -0800
commited6b69aab3136b2a5bcddbab77659640cd4d6534 (patch)
treea7c455fd49bb3c43847c1adb011c304c22878410 /webapp/stores
parent4a2fbcaf983e3180e00bb846f4ed65a2670b9251 (diff)
downloadchat-ed6b69aab3136b2a5bcddbab77659640cd4d6534.tar.gz
chat-ed6b69aab3136b2a5bcddbab77659640cd4d6534.tar.bz2
chat-ed6b69aab3136b2a5bcddbab77659640cd4d6534.zip
PLT-3754 EE: Add a Display Option to disable Join/Leave messages (#3808)
* PLT-3754 EE: Add a Display Option to disable Join/Leave messages * Differentiate between join/leave add/remove messages * Update user removed from channel text message
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/notification_store.jsx5
-rw-r--r--webapp/stores/post_store.jsx18
2 files changed, 22 insertions, 1 deletions
diff --git a/webapp/stores/notification_store.jsx b/webapp/stores/notification_store.jsx
index e05d20329..507954a10 100644
--- a/webapp/stores/notification_store.jsx
+++ b/webapp/stores/notification_store.jsx
@@ -6,6 +6,7 @@ import EventEmitter from 'events';
import Constants from 'utils/constants.jsx';
import UserStore from './user_store.jsx';
import ChannelStore from './channel_store.jsx';
+import PreferenceStore from './preference_store.jsx';
import * as Utils from 'utils/utils.jsx';
import * as PostUtils from 'utils/post_utils.jsx';
const ActionTypes = Constants.ActionTypes;
@@ -28,7 +29,9 @@ class NotificationStoreClass extends EventEmitter {
handleRecievedPost(post, msgProps) {
// Send desktop notification
if ((UserStore.getCurrentId() !== post.user_id || post.props.from_webhook === 'true')) {
- if (PostUtils.isSystemMessage(post) && post.type !== 'system_join_leave') {
+ if (PostUtils.isSystemMessage(post)) {
+ return;
+ } else if (!PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true) && post.type === Constants.POST_TYPE_JOIN_LEAVE) {
return;
}
diff --git a/webapp/stores/post_store.jsx b/webapp/stores/post_store.jsx
index 135563866..0b2277255 100644
--- a/webapp/stores/post_store.jsx
+++ b/webapp/stores/post_store.jsx
@@ -548,6 +548,24 @@ class PostStoreClass extends EventEmitter {
return commentCount;
}
+
+ filterPosts(channelId, joinLeave) {
+ const postsList = JSON.parse(JSON.stringify(this.getVisiblePosts(channelId)));
+
+ if (!joinLeave && postsList) {
+ postsList.order = postsList.order.filter((id) => {
+ if (postsList.posts[id].type === Constants.POST_TYPE_JOIN_LEAVE) {
+ Reflect.deleteProperty(postsList.posts, id);
+
+ return false;
+ }
+
+ return true;
+ });
+ }
+
+ return postsList;
+ }
}
var PostStore = new PostStoreClass();