* fixes MM-37294 MM-37296 MM-37297 * Added conditions to check for post & thread existence * Update app/mm-redux/selectors/entities/threads.ts Co-authored-by: Kyriakos Z. <3829551+koox00@users.noreply.github.com> * type fix * Never disabling Mark All as unread * Added follow/unfollow message for not yet thread posts * Test case fix for mark all as unread enabled all the time * Removed hardcoded condition * Fixed MM-37509 * Updated snapshot for sidebar Co-authored-by: Kyriakos Z. <3829551+koox00@users.noreply.github.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
48 lines
2 KiB
JavaScript
48 lines
2 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {connect} from 'react-redux';
|
|
import {bindActionCreators} from 'redux';
|
|
|
|
import {selectPost} from '@mm-redux/actions/posts';
|
|
import {setThreadFollow, updateThreadRead} from '@mm-redux/actions/threads';
|
|
import {getChannel, getMyCurrentChannelMembership} from '@mm-redux/selectors/entities/channels';
|
|
import {getCurrentUserId} from '@mm-redux/selectors/entities/common';
|
|
import {makeGetPostIdsForThread} from '@mm-redux/selectors/entities/posts';
|
|
import {getTheme, isCollapsedThreadsEnabled} from '@mm-redux/selectors/entities/preferences';
|
|
import {getThread} from '@mm-redux/selectors/entities/threads';
|
|
|
|
import Thread from './thread';
|
|
|
|
function makeMapStateToProps() {
|
|
const getPostIdsForThread = makeGetPostIdsForThread();
|
|
return function mapStateToProps(state, ownProps) {
|
|
const channel = getChannel(state, ownProps.channelId);
|
|
const collapsedThreadsEnabled = isCollapsedThreadsEnabled(state);
|
|
return {
|
|
channelId: ownProps.channelId,
|
|
channelIsArchived: channel ? channel.delete_at !== 0 : false,
|
|
channelType: channel ? channel.type : '',
|
|
collapsedThreadsEnabled,
|
|
currentUserId: getCurrentUserId(state),
|
|
displayName: channel ? channel.display_name : '',
|
|
myMember: getMyCurrentChannelMembership(state),
|
|
postIds: getPostIdsForThread(state, ownProps.rootId),
|
|
theme: getTheme(state),
|
|
thread: collapsedThreadsEnabled ? getThread(state, ownProps.rootId, true) : null,
|
|
threadLoadingStatus: state.requests.posts.getPostThread,
|
|
};
|
|
};
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
return {
|
|
actions: bindActionCreators({
|
|
selectPost,
|
|
setThreadFollow,
|
|
updateThreadRead,
|
|
}, dispatch),
|
|
};
|
|
}
|
|
|
|
export default connect(makeMapStateToProps, mapDispatchToProps)(Thread);
|