Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lmendoza/9313 qa notification email address in account settings doesnt update when theres a change #2304

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Notifications keep you up-to-date with activity in your ORCID record.
Updates are automatically sent to your ORCID inbox but you can also have
them sent to you by email. You can choose the kind of notifications you wish
to receive by email and how often you want to receive them
to receive by email and how often you want to receive them.
</p>
<p>
<i i18n="@@account.inAdditionToTheOptional">
Expand All @@ -14,7 +14,7 @@
these service messages per our
</i>
<a
class="underline black-url underline"
class="underline black-url underline italic"
i18n="@@account.privacypolicy"
href="/privacy-policy"
target="_blank"
Expand Down Expand Up @@ -86,8 +86,8 @@ <h4 class="orc-font-body" i18n="@@account.notificationEmailAddress">
</div>

<div class="row">
<h4 class="orc-font-body" i18n="@@account.emailFrequency">
Email frequency
<h4 class="orc-font-body" i18n="@@account.notificationEmailAddress">
Notification email address
</h4>
<p
class="margin-bottom-16 row margin-top-0"
Expand Down Expand Up @@ -125,7 +125,7 @@ <h4 class="orc-font-body" i18n="@@account.emailFrequency">
class="margin-bottom-8 row"
i18n="@@account.administrativeChangesSuchAs"
>
Adminstrative changes, such as being made a trusted individual
Administrative changes, such as being made a trusted individual
</label>
<mat-form-field
appearance="outline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { Overlay } from '@angular/cdk/overlay'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { RouterTestingModule } from '@angular/router/testing'
import { UserInfoService } from 'src/app/core/user-info/user-info.service'
import { RecordService } from 'src/app/core/record/record.service'
import { of } from 'rxjs'

describe('SettingsDefaultsEmailFrequencyComponent', () => {
let component: SettingsDefaultsEmailFrequencyComponent
Expand All @@ -30,10 +32,15 @@ describe('SettingsDefaultsEmailFrequencyComponent', () => {
UntypedFormBuilder,
PlatformInfoService,
ErrorHandlerService,
UserInfoService,
SnackbarService,
MatSnackBar,
Overlay,
{
provide: RecordService,
useValue: {
getRecord: () => of({}),
},
},
],
}).compileComponents()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import { MatLegacyDialog } from '@angular/material/legacy-dialog'
import { ModalEmailComponent } from 'src/app/cdk/side-bar/modals/modal-email/modal-email.component'
import { UserInfoService } from 'src/app/core/user-info/user-info.service'
import { RecordService } from 'src/app/core/record/record.service'
@Component({
selector: 'app-settings-defaults-email-frequency',
templateUrl: './settings-defaults-email-frequency.component.html',
Expand All @@ -41,7 +42,7 @@ export class SettingsDefaultsEmailFrequencyComponent
emailFrequenciesValues = EmailFrequenciesValues
form: UntypedFormGroup
primaryEmail: string
primaryEmailVerified: string
primaryEmailVerified: boolean

arialabelSetTheFrequency = $localize`:@@account.setTheFrequency:Set the frequency for update notifications`
ariaLabelSetTheFrequencyAdministrative = $localize`:@@account.setTheFrequencyAdministrative:Set the frequency for administrative change notifications`
Expand All @@ -53,15 +54,12 @@ export class SettingsDefaultsEmailFrequencyComponent
private _fb: UntypedFormBuilder,
private _emailFrequency: AccountDefaultEmailFrequenciesService,
private _dialog: MatLegacyDialog,
private _userInfoService: UserInfoService
private _record: RecordService
) {}

ngOnInit(): void {
this.loading.next(true)
this._userInfoService.getUserInfo().subscribe((value) => {
this.primaryEmail = value.PRIMARY_EMAIL
this.primaryEmailVerified = value.IS_PRIMARY_EMAIL_VERIFIED
})

this._emailFrequency.get().subscribe((value) => {
this.loading.next(false)
this.form = this._fb.group({
Expand Down Expand Up @@ -113,7 +111,16 @@ export class SettingsDefaultsEmailFrequencyComponent
.subscribe((platform) => {
this.isMobile = platform.columns4 || platform.columns8
})

this._record
.getRecord()
.pipe(takeUntil(this.$destroy))
.subscribe((userRecord) => {
this.primaryEmail = userRecord.emails.emails.find((email) => email.primary).value
this.primaryEmailVerified = userRecord.emails.emails.find((email) => email.primary).verified
})
}


openEmailModal() {
return this._dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class SettingsDefaultsComponent implements OnInit {
visibilityFrequencyLoading = false
visibilityExpanded = false
languageExpanded = false
titleEmailFrequency = $localize`:@@account.emailFrequency:Notification email frequency`
titleEmailFrequency = $localize`:@@account.notificationEmailAddress:Notification email frequency`
titleLanguage = $localize`:@@account.language:Language`
titleVisibility = $localize`:@@account.visibility:Visibility`

Expand Down
5 changes: 2 additions & 3 deletions src/locale/properties/account/account.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,18 @@ account.scopePathType.personUpdate=Add/update information about you (country, ke
account.scopePathType.readLimited=Read your information with visibility set to Trusted Parties
account.scopePathType.readPublic=Read public info only
account.scopePathType.webhook=Notifies Application if there are changes to your record
account.notifications=Notifications keep you up-to-date with activity in your ORCID record. Updates are automatically sent to your ORCID inbox but you can also have them sent to you by email. You can choose the kind of notifications you wish to receive by email and how often you want to receive them
account.notifications=Notifications keep you up-to-date with activity in your ORCID record. Updates are automatically sent to your ORCID inbox but you can also have them sent to you by email. You can choose the kind of notifications you wish to receive by email and how often you want to receive them.
account.inAdditionToTheOptional=In addition to the optional account and record notifications, we may occasionally send you emails with service messages relating to your ORCID account. As the information in these emails may affect your privacy settings and the functioning of your ORCID account, you cannot opt-out of these service messages per our
account.notificationEmailAddress=Notification email address
account.yourOrcidNotification=Your ORCID notification emails will be sent to:
account.unverifiedEmailAddress=Unverified email address
account.verifiedEmailAddress=Verified email address
account.manageYourEmails=Manage your emails
account.howOftenShouldWeSend=How often should we send you ORCID notification emails about:
account.administrativeChangesSuchAs=Adminstrative changes, such as being made a trusted individual
account.administrativeChangesSuchAs=Administrative changes, such as being made a trusted individual
account.tipsAndFeatures=Tips & features email
account.idLikeToReceiveTheOrcidTips=I’d like to receive the ORCID tips & features email
account.privacypolicy=Privacy Policy
account.setTheFrequency=Set the frequency for update notifications
account.setTheFrequencyAdministrative=Set the frequency for administrative change notifications
account.setTheFrequencyMember=Set the frequency for permission request notifications
=
Loading