* Added selectChannel action * Fixed selected team not being cleared on logout * Fixed posts and postsByChannel not being initialized correctly * Added basic post rendering * Renamed selectors files to be plural * Removed empty file * Fixed unit tests after merge * Removing unnecessary code
20 lines
537 B
JavaScript
20 lines
537 B
JavaScript
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import {createSelector} from 'reselect';
|
|
|
|
function getPosts(state) {
|
|
return state.entities.posts.posts;
|
|
}
|
|
|
|
function getPostIdsInCurrentChannel(state) {
|
|
return state.entities.posts.postsByChannel[state.entities.channels.currentId] || [];
|
|
}
|
|
|
|
export const getPostsInCurrentChannel = createSelector(
|
|
getPosts,
|
|
getPostIdsInCurrentChannel,
|
|
(posts, postIds) => {
|
|
return postIds.map((id) => posts[id]);
|
|
}
|
|
);
|