* Moved PostList to take a list of postIds instead of posts * Removed usage of selectors that return posts from ChannelPostList and Thread * Fixed search and switched to use getPostIdsAroundPost selector * Removed use of selectors that returned posts from emoji reactions * Updated makePreparePostIdsForPostList to be better memoized * Fixed filter of join/leave messages * Added unit tests for makePrepaprePostIdsForPostList * Check if post edit/delete should be enabled more often * Updated mattermost-redux version in yarn.lock
26 lines
941 B
JavaScript
26 lines
941 B
JavaScript
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import {connect} from 'react-redux';
|
|
|
|
import {getPost, makeGetPostIdsAroundPost} from 'mattermost-redux/selectors/entities/posts';
|
|
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
|
|
|
import SearchPreview from './search_preview';
|
|
|
|
function makeMapStateToProps() {
|
|
const getPostIdsAroundPost = makeGetPostIdsAroundPost();
|
|
|
|
return function mapStateToProps(state, ownProps) {
|
|
const post = getPost(state, ownProps.focusedPostId);
|
|
const postIds = getPostIdsAroundPost(state, post.id, post.channel_id, {postsBeforeCount: 5, postsAfterCount: 5});
|
|
|
|
return {
|
|
channelId: post.channel_id,
|
|
currentUserId: getCurrentUserId(state),
|
|
postIds
|
|
};
|
|
};
|
|
}
|
|
|
|
export default connect(makeMapStateToProps, null, null, {withRef: true})(SearchPreview);
|