diff --git a/app/soapbox/components/poll.js b/app/soapbox/components/poll.js index 3f10cfee1..7962ee779 100644 --- a/app/soapbox/components/poll.js +++ b/app/soapbox/components/poll.js @@ -12,6 +12,7 @@ import escapeTextContentForBrowser from 'escape-html'; import emojify from 'soapbox/features/emoji/emoji'; import RelativeTimestamp from './relative_timestamp'; import Icon from 'soapbox/components/icon'; +import { openModal } from 'soapbox/actions/modal'; const messages = defineMessages({ closed: { id: 'poll.closed', defaultMessage: 'Closed' }, @@ -33,7 +34,6 @@ class Poll extends ImmutablePureComponent { dispatch: PropTypes.func, disabled: PropTypes.bool, me: SoapboxPropTypes.me, - onOpenUnauthorizedModal: PropTypes.func.isRequired, }; state = { @@ -56,7 +56,7 @@ class Poll extends ImmutablePureComponent { this.setState({ selected: tmp }); } } else { - this.props.onOpenUnauthorizedModal(); + this.openUnauthorizedModal(); } } @@ -80,6 +80,10 @@ class Poll extends ImmutablePureComponent { this.props.dispatch(vote(this.props.poll.get('id'), Object.keys(this.state.selected))); }; + openUnauthorizedModal = () => { + this.props.dispatch(openModal('UNAUTHORIZED')); + } + handleRefresh = () => { if (this.props.disabled) { return; diff --git a/app/soapbox/containers/poll_container.js b/app/soapbox/containers/poll_container.js index 55f14e1b2..dc35964f5 100644 --- a/app/soapbox/containers/poll_container.js +++ b/app/soapbox/containers/poll_container.js @@ -1,5 +1,4 @@ import { connect } from 'react-redux'; -import { openModal } from 'soapbox/actions/modal'; import Poll from 'soapbox/components/poll'; const mapStateToProps = (state, { pollId }) => ({ @@ -7,10 +6,4 @@ const mapStateToProps = (state, { pollId }) => ({ me: state.get('me'), }); -const mapDispatchToProps = (dispatch) => ({ - onOpenUnauthorizedModal() { - dispatch(openModal('UNAUTHORIZED')); - }, -}); - -export default connect(mapStateToProps, mapDispatchToProps)(Poll); +export default connect(mapStateToProps)(Poll);