diff options
author | enahum <nahumhbl@gmail.com> | 2016-08-18 17:37:55 -0500 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-08-18 14:37:55 -0800 |
commit | ed6b69aab3136b2a5bcddbab77659640cd4d6534 (patch) | |
tree | a7c455fd49bb3c43847c1adb011c304c22878410 /webapp/components/post_view | |
parent | 4a2fbcaf983e3180e00bb846f4ed65a2670b9251 (diff) | |
download | chat-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/components/post_view')
-rw-r--r-- | webapp/components/post_view/post_focus_view_controller.jsx | 16 | ||||
-rw-r--r-- | webapp/components/post_view/post_view_controller.jsx | 15 |
2 files changed, 26 insertions, 5 deletions
diff --git a/webapp/components/post_view/post_focus_view_controller.jsx b/webapp/components/post_view/post_focus_view_controller.jsx index 4a7d312f5..a1c474184 100644 --- a/webapp/components/post_view/post_focus_view_controller.jsx +++ b/webapp/components/post_view/post_focus_view_controller.jsx @@ -34,8 +34,10 @@ export default class PostFocusView extends React.Component { profiles = Object.assign({}, profiles, UserStore.getDirectProfiles()); } + const joinLeaveEnabled = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true); + this.state = { - postList: PostStore.getVisiblePosts(focusedPostId), + postList: PostStore.filterPosts(focusedPostId, joinLeaveEnabled), currentUser: UserStore.getCurrentUser(), profiles, scrollType: ScrollTypes.POST, @@ -79,9 +81,11 @@ export default class PostFocusView extends React.Component { return; } + const joinLeaveEnabled = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true); + this.setState({ scrollPostId: focusedPostId, - postList: PostStore.getVisiblePosts(focusedPostId), + postList: PostStore.filterPosts(focusedPostId, joinLeaveEnabled), atTop: PostStore.getVisibilityAtTop(focusedPostId), atBottom: PostStore.getVisibilityAtBottom(focusedPostId) }); @@ -103,7 +107,15 @@ export default class PostFocusView extends React.Component { } onPreferenceChange() { + const focusedPostId = PostStore.getFocusedPostId(); + if (focusedPostId == null) { + return; + } + + const joinLeaveEnabled = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true); + this.setState({ + postList: PostStore.filterPosts(focusedPostId, joinLeaveEnabled), flaggedPosts: PreferenceStore.getCategory(Constants.Preferences.CATEGORY_FLAGGED_POST) }); } diff --git a/webapp/components/post_view/post_view_controller.jsx b/webapp/components/post_view/post_view_controller.jsx index 1dd5e9176..2451dfc8d 100644 --- a/webapp/components/post_view/post_view_controller.jsx +++ b/webapp/components/post_view/post_view_controller.jsx @@ -44,9 +44,11 @@ export default class PostViewController extends React.Component { lastViewed = member.last_viewed_at; } + const joinLeaveEnabled = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true); + this.state = { channel, - postList: PostStore.getVisiblePosts(channel.id), + postList: PostStore.filterPosts(channel.id, joinLeaveEnabled), currentUser: UserStore.getCurrentUser(), profiles, atTop: PostStore.getVisibilityAtTop(channel.id), @@ -83,7 +85,10 @@ export default class PostViewController extends React.Component { previewSuffix = '_' + Utils.generateId(); } + const joinLeaveEnabled = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true); + this.setState({ + postList: PostStore.filterPosts(this.state.channel.id, joinLeaveEnabled), displayNameType: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', 'false'), displayPostsInCenter: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_CENTERED, compactDisplay: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) === Preferences.MESSAGE_DISPLAY_COMPACT, @@ -103,8 +108,10 @@ export default class PostViewController extends React.Component { } onPostsChange() { + const joinLeaveEnabled = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true); + this.setState({ - postList: JSON.parse(JSON.stringify(PostStore.getVisiblePosts(this.state.channel.id))), + postList: PostStore.filterPosts(this.state.channel.id, joinLeaveEnabled), atTop: PostStore.getVisibilityAtTop(this.state.channel.id) }); } @@ -152,12 +159,14 @@ export default class PostViewController extends React.Component { profiles = Object.assign({}, profiles, UserStore.getDirectProfiles()); } + const joinLeaveEnabled = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'join_leave', true); + this.setState({ channel, lastViewed, ownNewMessage: false, profiles: JSON.parse(JSON.stringify(profiles)), - postList: JSON.parse(JSON.stringify(PostStore.getVisiblePosts(channel.id))), + postList: PostStore.filterPosts(channel.id, joinLeaveEnabled), displayNameType: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', 'false'), displayPostsInCenter: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_CENTERED, compactDisplay: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) === Preferences.MESSAGE_DISPLAY_COMPACT, |