mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user