diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index e908cd10a..3a1d96a64 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -156,6 +156,13 @@ export const routes: Routes = [ import('./core/components/forbidden-page/forbidden-page.component').then((mod) => mod.ForbiddenPageComponent), data: { skipBreadcrumbs: true }, }, + { + path: 'preprints/:providerId/:id/pending-moderation', + loadComponent: () => + import( + '@osf/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component' + ).then((mod) => mod.PreprintPendingModerationComponent), + }, { path: 'request-access/:id', loadComponent: () => diff --git a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts index ac9522746..0f02c16dc 100644 --- a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts +++ b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts @@ -383,6 +383,15 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { } } }, + error: (error) => { + if ( + error instanceof HttpErrorResponse && + error.status === 403 && + error?.error?.errors[0]?.detail === 'This preprint is pending moderation and is not yet publicly available.' + ) { + this.router.navigate(['/preprints', this.providerId(), preprintId, 'pending-moderation']); + } + }, }); } diff --git a/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.html b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.html new file mode 100644 index 000000000..df0d162c7 --- /dev/null +++ b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.html @@ -0,0 +1,4 @@ +
+

{{ 'preprints.details.moderationStatusBanner.pendingDetails.title' | translate }}

+

{{ 'preprints.details.moderationStatusBanner.pendingDetails.body' | translate }}

+
diff --git a/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.scss b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.scss new file mode 100644 index 000000000..c2c982a5b --- /dev/null +++ b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.scss @@ -0,0 +1,11 @@ +@use "styles/mixins" as mix; + +:host { + @include mix.flex-center; + flex: 1; + background: var(--gradient-3); +} + +.container { + max-width: mix.rem(448px); +} diff --git a/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.spec.ts b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.spec.ts new file mode 100644 index 000000000..27b3a577d --- /dev/null +++ b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PreprintPendingModerationComponent } from './preprint-pending-moderation.component'; + +import { OSFTestingModule } from '@testing/osf.testing.module'; + +describe('PreprintPendingModerationComponent', () => { + let component: PreprintPendingModerationComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [PreprintPendingModerationComponent, OSFTestingModule], + }).compileComponents(); + + fixture = TestBed.createComponent(PreprintPendingModerationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.ts b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.ts new file mode 100644 index 000000000..c6e482486 --- /dev/null +++ b/src/app/features/preprints/pages/preprint-pending-moderation/preprint-pending-moderation.component.ts @@ -0,0 +1,12 @@ +import { TranslatePipe } from '@ngx-translate/core'; + +import { ChangeDetectionStrategy, Component } from '@angular/core'; + +@Component({ + selector: 'osf-preprint-pending-moderation', + templateUrl: './preprint-pending-moderation.component.html', + styleUrl: './preprint-pending-moderation.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [TranslatePipe], +}) +export class PreprintPendingModerationComponent {} diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 4e1eafd6c..bec52031b 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -2115,6 +2115,7 @@ "poweredBy": "Powered by OSF Preprints", "searchPlaceholder": "Search {{preprintWord}}...", "showExample": "Show an example", + "browseBySubjects": { "title": "Browse By Subjects" }, @@ -2400,6 +2401,10 @@ "noModerationNotice": "{{pluralCapitalizedPreprintWord}} are a permanent part of the scholarly record. Withdrawal requests are subject to this service’s policy on {{singularPreprintWord}} version removal and at the discretion of the moderators.
This request will be submitted to {{supportEmail}} for review and removal. If the request is approved, this {{singularPreprintWord}} version will be replaced by a tombstone page with metadata and the reason for withdrawal. This {{singularPreprintWord}} version will still be searchable by other users after removal." }, "moderationStatusBanner": { + "pendingDetails": { + "title": "This Preprint Is Pending Moderation At OSF Preprints", + "body": "This preprint was submitted for review. It won't be available until it is accepted by the provider. Please check back later." + }, "recentActivity": { "pending": "submitted this {{documentType}} on", "accepted": "accepted this {{documentType}} on",