summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/components/CallView/shared/ReactionToaster.vue18
-rw-r--r--src/components/TopBar/ReactionMenu.vue27
2 files changed, 14 insertions, 31 deletions
diff --git a/src/components/CallView/shared/ReactionToaster.vue b/src/components/CallView/shared/ReactionToaster.vue
index 8d0a8ccd7..c329f8087 100644
--- a/src/components/CallView/shared/ReactionToaster.vue
+++ b/src/components/CallView/shared/ReactionToaster.vue
@@ -96,10 +96,10 @@ export default {
})
// unsubscribe disconnected models
- const removedModels = Object.keys(this.registeredModels).filter(registeredModelId => !models.find(model => model.attributes.peerId === registeredModelId))
- removedModels.forEach(removedModel => {
- this.registeredModels[removedModel].off('reaction', this.handleReaction)
- delete this.registeredModels[removedModel]
+ const removedModelIds = Object.keys(this.registeredModels).filter(registeredModelId => !models.find(model => model.attributes.peerId === registeredModelId))
+ removedModelIds.forEach(removedModelId => {
+ this.registeredModels[removedModelId].off('reaction', this.handleReaction)
+ delete this.registeredModels[removedModelId]
})
},
},
@@ -112,6 +112,10 @@ export default {
beforeDestroy() {
clearInterval(this.intervalId)
unsubscribe('send-reaction', this.handleOwnReaction)
+ Object.keys(this.registeredModels).forEach(modelId => {
+ this.registeredModels[modelId].off('reaction', this.handleReaction)
+ delete this.registeredModels[modelId]
+ })
},
methods: {
@@ -120,12 +124,18 @@ export default {
},
handleReaction(model, reaction) {
+ // prevent spamming to queue from a single account
+ if (this.reactionsQueue.some(item => item.id === model.attributes.peerId)) {
+ return
+ }
+
// prevent receiving anything rather than defined reactions in capabilities
if (!this.supportedReactions.includes(reaction)) {
return
}
this.reactionsQueue.push({
+ id: model.attributes.peerId,
reaction,
name: this.getParticipantName(model),
seed: Math.random(),
diff --git a/src/components/TopBar/ReactionMenu.vue b/src/components/TopBar/ReactionMenu.vue
index 940af7d15..38b4b3fa8 100644
--- a/src/components/TopBar/ReactionMenu.vue
+++ b/src/components/TopBar/ReactionMenu.vue
@@ -41,11 +41,6 @@
</template>
</NcActionButton>
</NcActionButtonGroup>
-
- <!-- TODO for development purposes, remove before release -->
- <NcActionButton @click="spamReaction">
- {{ spammer ? 'Stop spamming' : 'Spam reactions' }}
- </NcActionButton>
</NcActions>
</template>
@@ -98,8 +93,6 @@ export default {
data() {
return {
throttleTimer: null,
- // TODO for development purposes, remove before release
- spammer: null,
}
},
@@ -135,26 +128,6 @@ export default {
reaction,
})
},
-
- // TODO for development purposes, remove before release
- spamReaction() {
- if (this.spammer) {
- clearInterval(this.spammer)
- this.spammer = null
- return
- }
-
- this.spammer = setInterval(() => {
- const reactionRand = this.reactions[Math.floor(Math.random() * 10)]
- this.localCallParticipantModel.sendReaction(reactionRand)
-
- // show reaction to yourself
- emit('send-reaction', {
- model: this.localCallParticipantModel,
- reaction: reactionRand,
- })
- }, 1000)
- },
},
}
</script>