mattermost-mobile/app/components/autocomplete/at_mention/index.js
Chris Duarte 18cc7f1e7f PLT-5518 RN: Allow user to upload + send image file attachments (#373)
* PLT-5518 RN: Allow user to upload + send image file attachments

* Review feedback
2017-03-21 17:58:31 -04:00

45 lines
1.5 KiB
JavaScript

// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {getTheme} from 'app/selectors/preferences';
import {autocompleteUsersInChannel} from 'mattermost-redux/actions/users';
import {getDefaultChannel} from 'mattermost-redux/selectors/entities/channels';
import {getAutocompleteUsersInCurrentChannel} from 'mattermost-redux/selectors/entities/users';
import AtMention from './at_mention';
function mapStateToProps(state, ownProps) {
const {currentChannelId} = state.entities.channels;
let postDraft;
if (ownProps.rootId.length) {
postDraft = state.views.thread.drafts[ownProps.rootId].draft;
} else {
postDraft = state.views.channel.drafts[currentChannelId].draft;
}
return {
...ownProps,
currentUserId: state.entities.users.currentUserId,
currentChannelId,
currentTeamId: state.entities.teams.currentTeamId,
defaultChannel: getDefaultChannel(state),
postDraft,
autocompleteUsersInCurrentChannel: getAutocompleteUsersInCurrentChannel(state),
requestStatus: state.requests.users.autocompleteUsersInChannel.status,
theme: getTheme(state)
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
autocompleteUsersInChannel
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(AtMention);