aboutsummaryrefslogtreecommitdiff
path: root/src/modules/statuses.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/statuses.js')
-rw-r--r--src/modules/statuses.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index e6ee5447..5f09b8f5 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -494,6 +494,10 @@ export const mutations = {
const newStatus = state.allStatusesObject[id]
newStatus.favoritedBy = favoritedByUsers.filter(_ => _)
newStatus.rebloggedBy = rebloggedByUsers.filter(_ => _)
+ },
+ updateStatusWithPoll (state, { id, poll }) {
+ const status = state.allStatusesObject[id]
+ status.poll = poll
}
}
@@ -578,6 +582,18 @@ const statuses = {
]).then(([favoritedByUsers, rebloggedByUsers]) =>
commit('addFavsAndRepeats', { id, favoritedByUsers, rebloggedByUsers })
)
+ },
+ votePoll ({ rootState, commit }, { id, pollId, choices }) {
+ return rootState.api.backendInteractor.vote(pollId, choices).then(poll => {
+ commit('updateStatusWithPoll', { id, poll })
+ return poll
+ })
+ },
+ refreshPoll ({ rootState, commit }, { id, pollId }) {
+ return rootState.api.backendInteractor.fetchPoll(pollId).then(poll => {
+ commit('updateStatusWithPoll', { id, poll })
+ return poll
+ })
}
},
mutations