mattermost-mobile/app/components/autocomplete/channel_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

42 lines
1.3 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 {autocompleteChannels} from 'mattermost-redux/actions/channels';
import {getTheme} from 'app/selectors/preferences';
import {getAutocompleteChannelWithSections} from 'mattermost-redux/selectors/entities/channels';
import ChannelMention from './channel_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,
currentChannelId,
currentTeamId: state.entities.teams.currentTeamId,
postDraft,
autocompleteChannels: getAutocompleteChannelWithSections(state),
requestStatus: state.requests.channels.autocompleteChannels.status,
theme: getTheme(state)
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
autocompleteChannels
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(ChannelMention);