Skip to content

Commit

Permalink
Merge pull request #2389 from ORCID/lmendoza/9474-qa-email-domains-in…
Browse files Browse the repository at this point in the history
…terstitial-shown-in-oauth-flow-displayed-in-fixed-size-pop-up-window

Lmendoza/9474 qa email domains interstitial shown in oauth flow displayed in fixed size pop up window
  • Loading branch information
leomendoza123 authored Nov 8, 2024
2 parents a990a3c + f228b82 commit 1aa0b90
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);

.authorize-button {
.authorize-button {
color: $orcid-light-primary-text;
background: mat.get-color-from-palette($primary, 700);
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/authorize/pages/authorize/authorize.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class AuthorizeComponent {
organizationName: string
domainInterstitialHasBeenViewed: boolean
userIsNotImpersonating: boolean
insidePopUpWindows: boolean

constructor(
_user: UserService,
Expand All @@ -50,6 +51,7 @@ export class AuthorizeComponent {
}

ngOnInit() {
this.insidePopUpWindows = this.window.opener !== null
this._userInfo.getUserSession().subscribe((userInfo) => {
this.userIsNotImpersonating =
userInfo.userInfo.REAL_USER_ORCID ===
Expand Down Expand Up @@ -85,13 +87,13 @@ export class AuthorizeComponent {

handleRedirect(url: string) {
this.redirectUrl = url

if (
url &&
this.userHasPrivateDomains &&
this.oauthDomainsInterstitialEnabled &&
!this.domainInterstitialHasBeenViewed &&
this.userIsNotImpersonating
this.userIsNotImpersonating &&
!this.insidePopUpWindows
) {
this.showAuthorizationComponent = false
this.showInterstital = true
Expand Down
2 changes: 2 additions & 0 deletions src/app/cdk/interstitials/interstitials.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { MatCheckboxModule } from '@angular/material/checkbox'
import { MatLegacyCheckboxModule } from '@angular/material/legacy-checkbox'
import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button'
import { InfoPanelModule } from '../info-panel/info-panel.module'
import { A11yLinkModule } from '../a11y-link/a11y-link.module'

@NgModule({
declarations: [ShareEmailsDomainsComponent],
Expand All @@ -26,6 +27,7 @@ import { InfoPanelModule } from '../info-panel/info-panel.module'
MatLegacyCheckboxModule,
MatButtonModule,
InfoPanelModule,
A11yLinkModule,
],
exports: [ShareEmailsDomainsComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
i18n="@@interstitial.makeSelectedDomainsPublic"
(click)="accept(true)"
id="authorize-button"
[disabled]="!domainToMakePublic.length"
>
Make selected domains public
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);

.mat-raised-button.mat-primary {
.mat-raised-button.mat-primary:not(.mat-raised-button.mat-primary) {
background-color: mat.get-color-from-palette($primary, 700);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class ShareEmailsDomainsComponent {
@Input() userEmailsJson: EmailsEndpoint
@Input() organizationName: string
form: any
domainToMakePublic: string[]
constructor(
public platformInfo: PlatformInfoService,
private fb: FormBuilder,
Expand Down Expand Up @@ -58,11 +57,15 @@ export class ShareEmailsDomainsComponent {
})
}

accept(answear: boolean) {
this.domainToMakePublic = this.form.value.items
.filter((item) => item.selected)
.map((item) => item.email)
get domainToMakePublic(): string[] {
return (
this.form?.value?.items
?.filter((item: any) => item.selected)
.map((item: any) => item.email) || []
)
}

accept(answear: boolean) {
if (answear && this.domainToMakePublic.length > 0) {
this.userEmailsJson.emailDomains.forEach((domain) => {
if (this.domainToMakePublic.includes(domain.value)) {
Expand Down

0 comments on commit 1aa0b90

Please sign in to comment.