Skip to content

Commit

Permalink
fixup! feat(Poll): pop up new arrived polls for participants in the call
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Feb 19, 2024
1 parent 867df43 commit f721135
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export default {
return false
}

return !!this.$store.getters.getNewPolls[this.messageParameters.object.id]
return this.isInCall && !!this.$store.getters.getNewPolls[this.messageParameters.object.id]
},

hideDate() {
Expand Down
12 changes: 9 additions & 3 deletions src/components/PollViewer/PollViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ export default {
this.$store.dispatch('hidePollToast', value)
},

isInCall(value) {
if (!value) {
this.$store.dispatch('hideAllPollToasts')
}
},

poll: {
immediate: true,
handler(value) {
Expand All @@ -265,11 +271,11 @@ export default {
},

mounted() {
EventBus.$on('talk:poll-added', this.showPopup)
EventBus.$on('talk:poll-added', this.showPollToast)
},

beforeDestroy() {
EventBus.$off('talk:poll-added', this.showPopup)
EventBus.$off('talk:poll-added', this.showPollToast)
},

methods: {
Expand All @@ -288,7 +294,7 @@ export default {
: []
},

showPopup({ token, message }) {
showPollToast({ token, message }) {
if (!this.isInCall) {
return
}
Expand Down
11 changes: 11 additions & 0 deletions src/store/pollStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ const mutations = {
}
},

hideAllPollToasts(state) {
for (const id in state.pollToastsQueue) {
state.pollToastsQueue[id].hideToast()
Vue.delete(state.pollToastsQueue, id)
}
},

// Add debounce function for getting the poll data
addDebounceGetPollDataFunction(state, { token, pollId, debounceGetPollDataFunction }) {
if (!state.pollDebounceFunctions[token]) {
Expand Down Expand Up @@ -186,6 +193,10 @@ const actions = {
hidePollToast(context, id) {
context.commit('hidePollToast', id)
},

hideAllPollToasts(context) {
context.commit('hideAllPollToasts')
},
}

export default { state, mutations, getters, actions }

0 comments on commit f721135

Please sign in to comment.