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/9474 qa email domains interstitial shown in oauth flow displayed in fixed size pop up window #2389

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 @@ -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
Loading