Pass cookie for post actions (#2945)

This commit is contained in:
Michael Kochell 2019-07-02 08:18:34 -04:00 committed by Elias Nahum
parent c50215cf33
commit 1588f46ae4
3 changed files with 7 additions and 5 deletions

View file

@ -12,17 +12,18 @@ import ActionButtonText from './action_button_text';
export default class ActionButton extends PureComponent {
static propTypes = {
actions: PropTypes.shape({
doPostAction: PropTypes.func.isRequired,
doPostActionWithCookie: PropTypes.func.isRequired,
}).isRequired,
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
postId: PropTypes.string.isRequired,
theme: PropTypes.object.isRequired,
cookie: PropTypes.string.isRequired,
};
handleActionPress = preventDoubleTap(() => {
const {actions, id, postId} = this.props;
actions.doPostAction(postId, id);
const {actions, id, postId, cookie} = this.props;
actions.doPostActionWithCookie(postId, id, cookie);
}, 4000);
render() {

View file

@ -4,7 +4,7 @@
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {doPostAction} from 'mattermost-redux/actions/posts';
import {doPostActionWithCookie} from 'mattermost-redux/actions/posts';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
import ActionButton from './action_button';
@ -18,7 +18,7 @@ function mapStateToProps(state) {
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
doPostAction,
doPostActionWithCookie,
}, dispatch),
};
}

View file

@ -53,6 +53,7 @@ export default class AttachmentActions extends PureComponent {
<ActionButton
key={action.id}
id={action.id}
cookie={action.cookie}
name={action.name}
postId={postId}
/>