From e7e837dc4ebcfa80d2092a47eab4c35a34ccda98 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 2 Mar 2022 20:00:33 +0000 Subject: [PATCH] Use unique key to prevent email component reuse Signed-off-by: Christopher Ng Signed-off-by: nextcloud-command (cherry picked from commit fc03a935e859e619e8a1008a626cce68a581dae8) --- .../components/PersonalInfo/EmailSection/Email.vue | 1 - .../PersonalInfo/EmailSection/EmailSection.vue | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue index f9d3459aafe43..38c3bd3b89023 100644 --- a/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue +++ b/apps/settings/src/components/PersonalInfo/EmailSection/Email.vue @@ -50,7 +50,6 @@ {{ primaryEmail.value || t('settings', 'No email address set') }} + ({ ...properties, key: this.generateUniqueKey() })), displayNameChangeSupported, primaryEmail, isValidForm: true, @@ -110,7 +111,7 @@ export default { methods: { onAddAdditionalEmail() { if (this.$refs.form?.checkValidity()) { - this.additionalEmails.push({ value: '', scope: DEFAULT_ADDITIONAL_EMAIL_SCOPE }) + this.additionalEmails.push({ value: '', scope: DEFAULT_ADDITIONAL_EMAIL_SCOPE, key: this.generateUniqueKey() }) this.$nextTick(() => this.updateFormValidity()) } }, @@ -172,6 +173,10 @@ export default { updateFormValidity() { this.isValidForm = this.$refs.form?.checkValidity() }, + + generateUniqueKey() { + return Math.random().toString(36).substring(2) + }, }, }