From ec444384f41872c32cc50ee4b4db1d2b34c5354a Mon Sep 17 00:00:00 2001 From: Isabelle Lavandero <30595954+thefifthisa@users.noreply.github.com> Date: Fri, 17 Aug 2018 06:02:43 -0400 Subject: [PATCH] Add error notification for deleted user (#10600) * snackbar notification for deleted user * check for 404 * localize text --- website/client/components/chat/chatMessages.vue | 13 +++++++++++-- website/common/locales/en/messages.json | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/website/client/components/chat/chatMessages.vue b/website/client/components/chat/chatMessages.vue index 1b906d7edf..97cfb7d3e7 100644 --- a/website/client/components/chat/chatMessages.vue +++ b/website/client/components/chat/chatMessages.vue @@ -202,8 +202,17 @@ export default { if (!profile._id) { const result = await this.$store.dispatch('members:fetchMember', { memberId }); - this.cachedProfileData[memberId] = result.data.data; - profile = result.data.data; + if (result.response && result.response.status === 404) { + return this.$store.dispatch('snackbars:add', { + title: 'Habitica', + text: this.$t('messageDeletedUser'), + type: 'error', + timeout: false, + }); + } else { + this.cachedProfileData[memberId] = result.data.data; + profile = result.data.data; + } } // Open the modal only if the data is available diff --git a/website/common/locales/en/messages.json b/website/common/locales/en/messages.json index 615cae6091..c4a95cf359 100644 --- a/website/common/locales/en/messages.json +++ b/website/common/locales/en/messages.json @@ -69,5 +69,7 @@ "notificationsRequired": "Notification ids are required.", "unallocatedStatsPoints": "You have <%= points %> unallocated Stat Points", - "beginningOfConversation": "This is the beginning of your conversation with <%= userName %>. Remember to be kind, respectful, and follow the Community Guidelines!" + "beginningOfConversation": "This is the beginning of your conversation with <%= userName %>. Remember to be kind, respectful, and follow the Community Guidelines!", + + "messageDeletedUser": "Sorry, this user has deleted their account." }