diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-03-06 05:35:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-06 05:35:52 +0100 |
commit | fd128b9c7aa5c71adbfc2e223212514c0baee675 (patch) | |
tree | f88c6d60286250b7d77c1f545330eda2849cdd04 /app/javascript/mastodon/actions/polls.js | |
parent | 57643557b64bc1853c4aeb65fc652dac3467fa18 (diff) |
Fix poll options not rendering text after vote/refresh (#10189)
* Fix poll options not rendering text after vote/refresh * Fix poll options not showing up on public pages * Fix code style issue
Diffstat (limited to 'app/javascript/mastodon/actions/polls.js')
-rw-r--r-- | app/javascript/mastodon/actions/polls.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/javascript/mastodon/actions/polls.js b/app/javascript/mastodon/actions/polls.js index bee4c48a6..8e8b82df5 100644 --- a/app/javascript/mastodon/actions/polls.js +++ b/app/javascript/mastodon/actions/polls.js @@ -1,4 +1,5 @@ import api from '../api'; +import { importFetchedPoll } from './importer'; export const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST'; export const POLL_VOTE_SUCCESS = 'POLL_VOTE_SUCCESS'; @@ -12,7 +13,10 @@ export const vote = (pollId, choices) => (dispatch, getState) => { dispatch(voteRequest()); api(getState).post(`/api/v1/polls/${pollId}/votes`, { choices }) - .then(({ data }) => dispatch(voteSuccess(data))) + .then(({ data }) => { + dispatch(importFetchedPoll(data)); + dispatch(voteSuccess(data)); + }) .catch(err => dispatch(voteFail(err))); }; @@ -20,7 +24,10 @@ export const fetchPoll = pollId => (dispatch, getState) => { dispatch(fetchPollRequest()); api(getState).get(`/api/v1/polls/${pollId}`) - .then(({ data }) => dispatch(fetchPollSuccess(data))) + .then(({ data }) => { + dispatch(importFetchedPoll(data)); + dispatch(fetchPollSuccess(data)); + }) .catch(err => dispatch(fetchPollFail(err))); }; |