From ab67f6e257f6e8f08145a02a7b93550f99641be4 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Sun, 18 Jun 2017 14:42:32 -0400 Subject: PLT-6215 Major post list refactor (#6501) * Major post list refactor * Fix post and thread deletion * Fix preferences not selecting correctly * Fix military time displaying * Fix UP key for editing posts * Fix ESLint error * Various fixes and updates per feedback * Fix for permalink view * Revert to old scrolling method and various fixes * Add floating timestamp, new message indicator, scroll arrows * Update post loading for focus mode and add visibility limit * Fix pinning posts and a react warning * Add loading UI updates from Asaad * Fix refreshing loop * Temporarily bump post visibility limit * Update infinite scrolling * Remove infinite scrolling --- webapp/reducers/views/rhs.js | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 webapp/reducers/views/rhs.js (limited to 'webapp/reducers/views/rhs.js') diff --git a/webapp/reducers/views/rhs.js b/webapp/reducers/views/rhs.js new file mode 100644 index 000000000..1e6480743 --- /dev/null +++ b/webapp/reducers/views/rhs.js @@ -0,0 +1,63 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import {combineReducers} from 'redux'; +import {ActionTypes} from 'utils/constants.jsx'; +import {PostTypes} from 'mattermost-redux/action_types'; + +function selectedPostId(state = '', action) { + switch (action.type) { + case ActionTypes.SELECT_POST: + return action.postId; + case PostTypes.REMOVE_POST: + if (action.data && action.data.id === state) { + return ''; + } + return state; + default: + return state; + } +} + +function fromSearch(state = '', action) { + switch (action.type) { + case ActionTypes.SELECT_POST: + if (action.from_search) { + return action.from_search; + } + return ''; + default: + return state; + } +} + +function fromFlaggedPosts(state = false, action) { + switch (action.type) { + case ActionTypes.SELECT_POST: + if (action.from_flagged_posts) { + return action.from_flagged_posts; + } + return false; + default: + return state; + } +} + +function fromPinnedPosts(state = false, action) { + switch (action.type) { + case ActionTypes.SELECT_POST: + if (action.from_pinned_posts) { + return action.from_pinned_posts; + } + return false; + default: + return state; + } +} + +export default combineReducers({ + selectedPostId, + fromSearch, + fromFlaggedPosts, + fromPinnedPosts +}); -- cgit v1.2.3-1-g7c22