From 550042dd9dc79b3684467eb232bb6061140ee291 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Wed, 18 Dec 2024 10:33:57 -0500 Subject: [PATCH] Fix registration tests --- app/preprints/new-version/route.ts | 1 - mirage/views/review-action.ts | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/preprints/new-version/route.ts b/app/preprints/new-version/route.ts index 0f3ee1963c..fe76765749 100644 --- a/app/preprints/new-version/route.ts +++ b/app/preprints/new-version/route.ts @@ -36,7 +36,6 @@ export default class PreprintNewVersionRoute extends Route { const preprint: PreprintModel = await this.store.findRecord('preprint', args.guid); if (!preprint.canCreateNewVersion) { - // TODO: translate and add message body details let message = this.intl.t('prperints.submit.new-version.redirect.latest-published', { preprintWord: provider.documentType.singular }); if (!preprint.currentUserIsAdmin) { diff --git a/mirage/views/review-action.ts b/mirage/views/review-action.ts index f6ebfc7097..8e34488c86 100644 --- a/mirage/views/review-action.ts +++ b/mirage/views/review-action.ts @@ -2,9 +2,8 @@ import { HandlerContext, ModelInstance, NormalizedRequestAttrs, Request, Schema import { PreprintMirageModel } from 'ember-osf-web/mirage/factories/preprint'; import { MirageRegistration } from 'ember-osf-web/mirage/factories/registration'; import { MirageReviewAction } from 'ember-osf-web/mirage/factories/review-action'; -import PreprintModel from 'ember-osf-web/models/preprint'; import { ReviewsState } from 'ember-osf-web/models/provider'; -import RegistrationModel, { RegistrationReviewStates } from 'ember-osf-web/models/registration'; +import { RegistrationReviewStates } from 'ember-osf-web/models/registration'; import { ReviewActionTrigger } from 'ember-osf-web/models/review-action'; import { RevisionReviewStates } from 'ember-osf-web/models/schema-response'; @@ -25,7 +24,7 @@ export function createReviewAction(this: HandlerContext, schema: Schema, request dateModified: new Date(), ...attrs, }); - if (target instanceof PreprintModel) { + if (target.modelName === 'preprint') { switch (trigger) { case ReviewActionTrigger.Submit: target.reviewsState = ReviewsState.PENDING; @@ -40,7 +39,7 @@ export function createReviewAction(this: HandlerContext, schema: Schema, request default: break; } - } else if (target instanceof RegistrationModel) { + } else if (target.modelName === 'registration') { switch (trigger) { case ReviewActionTrigger.AcceptSubmission: case ReviewActionTrigger.RejectWithdrawal: