summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
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();