diff --git a/website/client/components/chat/reportFlagModal.vue b/website/client/components/chat/reportFlagModal.vue index 5cfc61c0a6..9a96cffa2c 100644 --- a/website/client/components/chat/reportFlagModal.vue +++ b/website/client/components/chat/reportFlagModal.vue @@ -96,16 +96,10 @@ export default { }; }, created () { - this.$root.$on('habitica::report-chat', data => { - if (!data.message || !data.groupId) return; - this.abuseObject = data.message; - this.groupId = data.groupId; - this.reportComment = ''; - this.$root.$emit('bv::show::modal', 'report-flag'); - }); + this.$root.$on('habitica::report-chat', this.handleReport); }, destroyed () { - this.$root.$off('habitica::report-chat'); + this.$root.$off('habitica::report-chat', this.handleReport); }, methods: { close () { @@ -129,6 +123,13 @@ export default { }); this.close(); }, + handleReport (data) { + if (!data.message || !data.groupId) return; + this.abuseObject = data.message; + this.groupId = data.groupId; + this.reportComment = ''; + this.$root.$emit('bv::show::modal', 'report-flag'); + }, }, };