diff options
author | Maksim Sukharev <antreesy.web@gmail.com> | 2023-04-20 16:22:35 +0200 |
---|---|---|
committer | Maksim Sukharev <antreesy.web@gmail.com> | 2023-04-20 16:22:35 +0200 |
commit | e08f6a97fcda2d834c3df130312b4dc4537aedce (patch) | |
tree | 65e47b2d352e367824bbd1f044365973b67c7671 /src/components/CallView | |
parent | d3adefe2477426739094254543389550d15aaa3b (diff) |
delete spam method, add spam-guard on a receiving end, improve models handling
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
Diffstat (limited to 'src/components/CallView')
-rw-r--r-- | src/components/CallView/shared/ReactionToaster.vue | 18 |
1 files changed, 14 insertions, 4 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(), |