From 39c167fe7fdf657f5d58c7607a7b9f522f9f57b1 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 24 Jul 2024 21:25:49 +0300 Subject: [PATCH 1/3] Fix verified email deletion logic (#2307) * fix deleting verified emails logic * fix logic --- .../modals/modal-email/modal-email.component.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts index 6f25d9704..6bc34acee 100644 --- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts +++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts @@ -247,12 +247,17 @@ export class ModalEmailComponent implements OnInit, OnDestroy { } setNextEmailAsPrimary() { - const verifiedEmails = this.emails.filter((email) => email.verified) - const currentIndex = verifiedEmails.findIndex( + let emails = this.emails.filter((email) => email.verified) + // If there are no verified emails left, set any next email as primary + // we're counting the one being deleted + if (emails.length <= 1) { + emails = this.emails + } + const currentIndex = emails.findIndex( (value) => value.putCode === this.primaryEmail.putCode ) - const nextIndex = (currentIndex + 1) % verifiedEmails.length - const nextEmail = verifiedEmails[nextIndex] + const nextIndex = (currentIndex + 1) % emails.length + const nextEmail = emails[nextIndex] this.makePrimary(nextEmail) } @@ -402,7 +407,6 @@ export class ModalEmailComponent implements OnInit, OnDestroy { if (controlKey === this.primaryEmail?.putCode) { this.setNextEmailAsPrimary() } - const i = this.emails.findIndex((value) => value.putCode === controlKey) this.emails.splice(i, 1) this.emailsForm.removeControl(controlKey) From 9b1e0d17c6f1850c21f0f9173b1725f195308b57 Mon Sep 17 00:00:00 2001 From: github actions Date: Wed, 24 Jul 2024 18:35:31 +0000 Subject: [PATCH 2/3] v2.102.9 changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94f51cf4d..5ee17c237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v2.102.9 - 2024-07-24 + +[Full Changelog](https://github.com/ORCID/orcid-angular/compare/v2.102.8...v2.102.9) + ## v2.102.8 - 2024-07-24 [Full Changelog](https://github.com/ORCID/orcid-angular/compare/v2.102.7...v2.102.8) From 779a007a0c2139a9c7bb546c69576b4f7fa6b431 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 24 Jul 2024 21:57:47 +0300 Subject: [PATCH 3/3] improve dropdown activation logic (#2308) --- .../side-bar/modals/modal-email/modal-email.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html index 72d6c8dab..98748483f 100644 --- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html +++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html @@ -256,10 +256,10 @@