diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html
index 8a8a4af30..6e19e1bd8 100644
--- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html
+++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html
@@ -36,53 +36,26 @@
@switch (currentStep().value) {
@case (PreprintSteps.TitleAndAbstract) {
-
+
}
@case (PreprintSteps.File) {
-
+
}
@case (PreprintSteps.Metadata) {
}
@case (PreprintSteps.AuthorAssertions) {
-
+
}
@case (PreprintSteps.Supplements) {
-
+
}
@case (PreprintSteps.Review) {
-
+
}
}
diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts
index 69345de2a..e35e056c7 100644
--- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts
+++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts
@@ -19,10 +19,6 @@ import { provideOSFCore } from '@testing/osf.testing.provider';
import { BrandServiceMock, BrandServiceMockType } from '@testing/providers/brand-service.mock';
import { BrowserTabServiceMock, BrowserTabServiceMockType } from '@testing/providers/browser-tab-service.mock';
import { HeaderStyleServiceMock, HeaderStyleServiceMockType } from '@testing/providers/header-style-service.mock';
-import {
- PreprintDraftDeletionServiceMock,
- PreprintDraftDeletionServiceMockType,
-} from '@testing/providers/preprint-draft-deletion-provider.mock';
import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock';
import { mergeSignalOverrides, provideMockStore, SignalOverride } from '@testing/providers/store-provider.mock';
@@ -35,14 +31,8 @@ import { TitleAndAbstractStepComponent } from '../../components/stepper/title-an
import { submitPreprintSteps } from '../../constants';
import { PreprintSteps, ReviewsState } from '../../enums';
import { PreprintProviderDetails } from '../../models';
-import { PreprintDraftDeletionService } from '../../services/preprint-draft-deletion.service';
import { GetPreprintProviderById, PreprintProvidersSelectors } from '../../store/preprint-providers';
-import {
- DeletePreprint,
- FetchPreprintById,
- PreprintStepperSelectors,
- ResetPreprintStepperState,
-} from '../../store/preprint-stepper';
+import { FetchPreprintById, PreprintStepperSelectors, ResetPreprintStepperState } from '../../store/preprint-stepper';
import { UpdatePreprintStepperComponent } from './update-preprint-stepper.component';
@@ -53,7 +43,6 @@ describe('UpdatePreprintStepperComponent', () => {
let brandServiceMock: BrandServiceMockType;
let headerStyleMock: HeaderStyleServiceMockType;
let browserTabMock: BrowserTabServiceMockType;
- let draftDeletionMock: PreprintDraftDeletionServiceMockType;
const mockProvider: PreprintProviderDetails = PREPRINT_PROVIDER_DETAILS_MOCK;
const mockPreprint = PREPRINT_MOCK;
@@ -78,7 +67,6 @@ describe('UpdatePreprintStepperComponent', () => {
brandServiceMock = BrandServiceMock.simple();
headerStyleMock = HeaderStyleServiceMock.simple();
browserTabMock = BrowserTabServiceMock.simple();
- draftDeletionMock = PreprintDraftDeletionServiceMock.simple();
TestBed.configureTestingModule({
imports: [
@@ -104,12 +92,6 @@ describe('UpdatePreprintStepperComponent', () => {
],
});
- TestBed.overrideComponent(UpdatePreprintStepperComponent, {
- set: {
- providers: [{ provide: PreprintDraftDeletionService, useValue: draftDeletionMock }],
- },
- });
-
store = TestBed.inject(Store);
fixture = TestBed.createComponent(UpdatePreprintStepperComponent);
component = fixture.componentInstance;
@@ -325,44 +307,4 @@ describe('UpdatePreprintStepperComponent', () => {
expect(component.currentStep()).toEqual(firstStep);
});
-
- it('should return false from isPreprintRejected when preprint is not rejected', () => {
- setup();
-
- expect(component.isPreprintRejected()).toBe(false);
- });
-
- it('should return true from isPreprintRejected when preprint is rejected', () => {
- setup({
- selectorOverrides: [
- {
- selector: PreprintStepperSelectors.getPreprint,
- value: { ...mockPreprint, reviewsState: ReviewsState.Rejected },
- },
- ],
- });
-
- expect(component.isPreprintRejected()).toBe(true);
- });
-
- it('should request draft deletion with update redirect and action callbacks', () => {
- setup();
-
- component.requestDeletePreprint();
-
- expect(draftDeletionMock.confirmDeleteDraft).toHaveBeenCalledWith(
- expect.objectContaining({
- redirectUrl: '/my-preprints',
- onDelete: expect.any(Function),
- onReset: expect.any(Function),
- })
- );
-
- const { onDelete, onReset } = draftDeletionMock.confirmDeleteDraft.mock.calls[0][0];
- onDelete();
- onReset();
-
- expect(store.dispatch).toHaveBeenCalledWith(new DeletePreprint());
- expect(store.dispatch).toHaveBeenCalledWith(new ResetPreprintStepperState());
- });
});
diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts
index 16b98abb5..3ea582ae1 100644
--- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts
+++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts
@@ -36,7 +36,6 @@ import { SupplementsStepComponent } from '../../components/stepper/supplements-s
import { TitleAndAbstractStepComponent } from '../../components/stepper/title-and-abstract-step/title-and-abstract-step.component';
import { submitPreprintSteps } from '../../constants';
import { PreprintSteps, ProviderReviewsWorkflow, ReviewsState } from '../../enums';
-import { PreprintDraftDeletionService } from '../../services/preprint-draft-deletion.service';
import { GetPreprintProviderById, PreprintProvidersSelectors } from '../../store/preprint-providers';
import {
DeletePreprint,
@@ -61,7 +60,6 @@ import {
templateUrl: './update-preprint-stepper.component.html',
styleUrl: './update-preprint-stepper.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
- providers: [PreprintDraftDeletionService],
})
export class UpdatePreprintStepperComponent implements OnDestroy, CanDeactivateComponent {
@HostBinding('class') classes = 'flex-1 flex flex-column w-full';
@@ -70,39 +68,36 @@ export class UpdatePreprintStepperComponent implements OnDestroy, CanDeactivateC
private readonly brandService = inject(BrandService);
private readonly headerStyleHelper = inject(HeaderStyleService);
private readonly browserTabHelper = inject(BrowserTabService);
- private readonly draftDeletionService = inject(PreprintDraftDeletionService);
- private providerId = toSignal(this.route.params.pipe(map((params) => params['providerId'])));
- private preprintId = toSignal(this.route.params.pipe(map((params) => params['preprintId'])));
+ private readonly providerId = toSignal(this.route.params.pipe(map((params) => params['providerId'])));
+ private readonly preprintId = toSignal(this.route.params.pipe(map((params) => params['preprintId'])));
- private actions = createDispatchMap({
+ private readonly actions = createDispatchMap({
getPreprintProviderById: GetPreprintProviderById,
resetState: ResetPreprintStepperState,
fetchPreprint: FetchPreprintById,
deletePreprint: DeletePreprint,
});
- preprintProvider = select(PreprintProvidersSelectors.getPreprintProviderDetails(this.providerId()));
- preprint = select(PreprintStepperSelectors.getPreprint);
- isPreprintProviderLoading = select(PreprintProvidersSelectors.isPreprintProviderDetailsLoading);
- hasBeenSubmitted = select(PreprintStepperSelectors.hasBeenSubmitted);
- hasAdminAccess = select(PreprintStepperSelectors.hasAdminAccess);
+ readonly preprintProvider = select(PreprintProvidersSelectors.getPreprintProviderDetails(this.providerId()));
+ readonly preprint = select(PreprintStepperSelectors.getPreprint);
+ readonly isPreprintProviderLoading = select(PreprintProvidersSelectors.isPreprintProviderDetailsLoading);
+ readonly hasBeenSubmitted = select(PreprintStepperSelectors.hasBeenSubmitted);
+ readonly hasAdminAccess = select(PreprintStepperSelectors.hasAdminAccess);
- isWeb = toSignal(inject(IS_WEB));
+ readonly isWeb = toSignal(inject(IS_WEB));
- currentStep = signal(submitPreprintSteps[0]);
+ readonly currentStep = signal(submitPreprintSteps[0]);
readonly PreprintSteps = PreprintSteps;
- editAndResubmitMode = computed(() => {
+ readonly editAndResubmitMode = computed(() => {
const providerIsPremod = this.preprintProvider()?.reviewsWorkflow === ProviderReviewsWorkflow.PreModeration;
const preprintIsRejected = this.preprint()?.reviewsState === ReviewsState.Rejected;
return providerIsPremod && preprintIsRejected;
});
- isPreprintRejected = computed(() => this.preprint()?.reviewsState === ReviewsState.Rejected);
-
readonly updateSteps = computed(() => {
const provider = this.preprintProvider();
const preprint = this.preprint();
@@ -184,12 +179,4 @@ export class UpdatePreprintStepperComponent implements OnDestroy, CanDeactivateC
this.currentStep.set(prevStep);
}
}
-
- requestDeletePreprint(): void {
- this.draftDeletionService.confirmDeleteDraft({
- onDelete: () => this.actions.deletePreprint(),
- onReset: () => this.actions.resetState(),
- redirectUrl: '/my-preprints',
- });
- }
}