forked from Ivasoft/mattermost-mobile
* 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 * Global thread actions init * Added options * Update post_options.js * Test cases fix * Added border bottom for each thread option * Update test case * Reverting snapshot * Updated snapshot * Moved options to screens & removed redundants translations * Reusing post_option for thread_option * Component name changed to PostOption from ThreadOption * Snapshot updated * Removed factory * Update app/screens/thread_options/index.ts Co-authored-by: Elias Nahum <nahumhbl@gmail.com> * Update app/screens/thread_options/index.ts Co-authored-by: Elias Nahum <nahumhbl@gmail.com> Co-authored-by: Kyriakos Z. <3829551+koox00@users.noreply.github.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {connect} from 'react-redux';
|
|
import {bindActionCreators, Dispatch} from 'redux';
|
|
|
|
import {getPost} from '@actions/views/post';
|
|
import {getChannel} from '@mm-redux/selectors/entities/channels';
|
|
import {getPost as getPostSelector} from '@mm-redux/selectors/entities/posts';
|
|
import {getThread} from '@mm-redux/selectors/entities/threads';
|
|
import {getUser} from '@mm-redux/selectors/entities/users';
|
|
|
|
import ThreadItem, {DispatchProps, OwnProps, StateProps} from './thread_item';
|
|
|
|
import type {GlobalState} from '@mm-redux/types/store';
|
|
|
|
function mapStateToProps(state: GlobalState, props: OwnProps) {
|
|
const {threadId} = props;
|
|
const post = getPostSelector(state, threadId);
|
|
return {
|
|
channel: getChannel(state, post?.channel_id),
|
|
post: getPostSelector(state, threadId),
|
|
thread: getThread(state, threadId),
|
|
threadStarter: getUser(state, post?.user_id),
|
|
};
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch: Dispatch) {
|
|
return {
|
|
actions: bindActionCreators({
|
|
getPost,
|
|
}, dispatch),
|
|
};
|
|
}
|
|
|
|
export default connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)(ThreadItem);
|