Skip to content

Commit

Permalink
Merge pull request #33037 from nextcloud/backport/31345/stable22
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jul 7, 2022
2 parents 92154d0 + 57c2a8a commit 28259ad
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
14 changes: 7 additions & 7 deletions apps/settings/js/vue-settings-personal-info.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-personal-info.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<Actions
class="actions-email"
:aria-label="t('settings', 'Email options')"
:disabled="deleteDisabled"
:force-menu="true">
<ActionButton
:aria-label="deleteEmailLabel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
<span v-else>
{{ primaryEmail.value || t('settings', 'No email address set') }}
</span>
<!-- TODO use unique key for additional email when uniqueness can be guaranteed, see https://github.com/nextcloud/server/issues/26866 -->
<Email v-for="(additionalEmail, index) in additionalEmails"
:key="index"
:key="additionalEmail.key"
:index="index"
:scope.sync="additionalEmail.scope"
:email.sync="additionalEmail.value"
Expand Down Expand Up @@ -77,7 +78,7 @@ export default {

data() {
return {
additionalEmails,
additionalEmails: additionalEmails.map(properties => ({ ...properties, key: this.generateUniqueKey() })),
displayNameChangeSupported,
primaryEmail,
isValidForm: true,
Expand Down Expand Up @@ -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())
}
},
Expand Down Expand Up @@ -172,6 +173,10 @@ export default {
updateFormValidity() {
this.isValidForm = this.$refs.form?.checkValidity()
},

generateUniqueKey() {
return Math.random().toString(36).substring(2)
},
},
}
</script>
Expand Down

0 comments on commit 28259ad

Please sign in to comment.