* 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
17 lines
679 B
JavaScript
17 lines
679 B
JavaScript
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import {addReaction} from 'mattermost-redux/actions/posts';
|
|
import {getPostIdsInCurrentChannel, makeGetPostIdsForThread} from 'mattermost-redux/selectors/entities/posts';
|
|
|
|
const getPostIdsForThread = makeGetPostIdsForThread();
|
|
|
|
export function addReactionToLatestPost(emoji, rootId) {
|
|
return async (dispatch, getState) => {
|
|
const state = getState();
|
|
const postIds = rootId ? getPostIdsForThread(state, rootId) : getPostIdsInCurrentChannel(state);
|
|
const lastPostId = postIds[0];
|
|
|
|
dispatch(addReaction(lastPostId, emoji));
|
|
};
|
|
}
|