Skip to content
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,6 +8,9 @@
@case (SubmissionReviewStatus.Accepted) {
<span class="capitalize">{{ 'moderation.submissionReview.accepted' | translate }}</span>
}
@case (SubmissionReviewStatus.PendingWithdrawal) {
<span class="capitalize">{{ 'moderation.submissionReview.withdrawalRequested' | translate }}</span>
}
}
<span>{{ action.dateModified | dateAgo }}</span>
<span>{{ 'moderation.submissionReview.by' | translate }}</span>
Expand All @@ -20,20 +23,21 @@
}

<form [formGroup]="requestForm" class="flex flex-column gap-3">
@if (isPendingModeration || isPendingReview) {
@if (isPendingModeration || isPendingReview || isPendingWithdrawal) {
<div class="flex flex-column gap-2">
<div class="flex gap-2">
<p-radioButton
[formControlName]="ModerationDecisionFormControls.Action"
inputId="accept-action"
[value]="
isPendingReview ? ReviewActionTrigger.AcceptSubmission : SchemaResponseActionTrigger.AcceptRevision
"
[value]="acceptValue"
></p-radioButton>
<label for="accept-action" class="m-0 flex gap-2 flex-column">
@if (isPendingReview) {
<p class="font-bold">{{ 'moderation.makeDecision.acceptRequest' | translate }}</p>
<p>{{ 'moderation.makeDecision.acceptRequestMessage' | translate }}</p>
} @else if (isPendingWithdrawal) {
<p class="font-bold">{{ 'moderation.makeDecision.acceptWithdrawal' | translate }}</p>
<p>{{ 'moderation.makeDecision.acceptWithdrawalMessage' | translate }}</p>
} @else {
<p class="font-bold">{{ 'moderation.makeDecision.acceptUpdate' | translate }}</p>
<p>{{ 'moderation.makeDecision.acceptUpdateMessage' | translate }}</p>
Expand All @@ -44,14 +48,15 @@
<p-radioButton
[formControlName]="ModerationDecisionFormControls.Action"
inputId="reject-action"
[value]="
isPendingReview ? ReviewActionTrigger.RejectSubmission : SchemaResponseActionTrigger.RejectRevision
"
[value]="rejectValue"
></p-radioButton>
<label for="reject-action" class="m-0 flex gap-2 flex-column">
@if (isPendingReview) {
<p class="font-bold">{{ 'moderation.makeDecision.rejectRequest' | translate }}</p>
<p>{{ 'moderation.makeDecision.rejectRequestMessage' | translate }}</p>
} @else if (isPendingWithdrawal) {
<p class="font-bold">{{ 'moderation.makeDecision.rejectWithdrawal' | translate }}</p>
<p>{{ 'moderation.makeDecision.rejectWithdrawalMessage' | translate }}</p>
} @else {
<p class="font-bold">{{ 'moderation.makeDecision.rejectUpdate' | translate }}</p>
<p>{{ 'moderation.makeDecision.rejectUpdateMessage' | translate }}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export class RegistryMakeDecisionComponent {
return this.registry.reviewsState === RegistrationReviewStates.Pending;
}

get isPendingWithdrawal(): boolean {
return this.registry.reviewsState === RegistrationReviewStates.PendingWithdraw;
}

get canWithdraw(): boolean {
return (
this.registry.reviewsState === RegistrationReviewStates.Accepted &&
Expand All @@ -92,6 +96,24 @@ export class RegistryMakeDecisionComponent {
);
}

get acceptValue(): string {
if (this.isPendingReview) {
return ReviewActionTrigger.AcceptSubmission;
} else if (this.isPendingWithdrawal) {
return ReviewActionTrigger.AcceptWithdrawal;
}
return SchemaResponseActionTrigger.AcceptRevision;
}

get rejectValue(): string {
if (this.isPendingReview) {
return ReviewActionTrigger.RejectSubmission;
} else if (this.isPendingWithdrawal) {
return ReviewActionTrigger.RejectWithdrawal;
}
return SchemaResponseActionTrigger.RejectRevision;
}

constructor() {
this.initForm();

Expand Down Expand Up @@ -122,6 +144,7 @@ export class RegistryMakeDecisionComponent {
return (
action === ReviewActionTrigger.RejectSubmission ||
action === SchemaResponseActionTrigger.RejectRevision ||
action === ReviewActionTrigger.RejectWithdrawal ||
action === ReviewActionTrigger.ForceWithdraw
);
}
Expand Down
12 changes: 6 additions & 6 deletions src/app/features/registry/mappers/registry-overview.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
middleName: contributor?.embeds?.users?.data?.attributes?.middle_names,
type: contributor?.embeds?.users?.data?.type,
})),
identifiers: IdentifiersMapper.fromJsonApi(data.embeds.identifiers),
identifiers: IdentifiersMapper.fromJsonApi(data.embeds?.identifiers),
analyticsKey: data.attributes?.analytics_key,
currentUserCanComment: data.attributes.current_user_can_comment,
currentUserPermissions: data.attributes.current_user_permissions,
Expand All @@ -49,11 +49,11 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
hasMaterials: data.attributes.has_materials,
hasPapers: data.attributes.has_papers,
hasSupplements: data.attributes.has_supplements,
license: LicensesMapper.fromLicenseDataJsonApi(data.embeds.license.data),
license: LicensesMapper.fromLicenseDataJsonApi(data.embeds?.license?.data),
registrationSchemaLink: data.relationships.registration_schema.links.related.href,
associatedProjectId: data.relationships?.registered_from?.data?.id,
schemaResponses: data.embeds?.schema_responses?.data?.map((item) => RegistrationMapper.fromSchemaResponse(item)),
provider: RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds.provider.data),
provider: RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds?.provider?.data),
status: MapRegistryStatus(data.attributes),
revisionStatus: data.attributes.revision_state,
reviewsState: data.attributes.reviews_state,
Expand All @@ -68,9 +68,9 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry

export function MapRegistrationOverview(data: RegistryOverviewJsonApiData) {
const registrationAttributes = RegistrationNodeMapper.getRegistrationNodeAttributes(data.id, data.attributes);
const providerInfo = RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds.provider.data);
const identifiers = IdentifiersMapper.fromJsonApi(data.embeds.identifiers);
const license = LicensesMapper.fromLicenseDataJsonApi(data.embeds.license.data);
const providerInfo = RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds?.provider?.data);
const identifiers = IdentifiersMapper.fromJsonApi(data.embeds?.identifiers);
const license = LicensesMapper.fromLicenseDataJsonApi(data.embeds?.license?.data);

return {
...registrationAttributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>
} @else {
<div class="flex flex-column bg-white flex-1 p-4 gap-4">
@if (!schemaResponse()?.isOriginalResponse && !isInitialState) {
@if (schemaResponse() && !schemaResponse()?.isOriginalResponse && !isInitialState) {
<p-message class="overview-message w-full" severity="warn">
<ng-template #container>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ export class RegistryOverviewComponent {
readonly schemaResponse = computed(() => {
const registry = this.registry();
const index = this.selectedRevisionIndex();
this.revisionInProgress = registry?.schemaResponses.find(
this.revisionInProgress = registry?.schemaResponses?.find(
(r) => r.reviewsState === RevisionReviewStates.RevisionInProgress
);

const schemaResponses =
(this.isModeration
? registry?.schemaResponses
: registry?.schemaResponses.filter(
: registry?.schemaResponses?.filter(
(r) => r.reviewsState === RevisionReviewStates.Approved || this.hasAdminAccess()
)) || [];

Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/mappers/identifiers.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Identifier, IdentifiersJsonApiData, ResponseJsonApi } from '@shared/mod

export class IdentifiersMapper {
static fromJsonApi(response: ResponseJsonApi<IdentifiersJsonApiData[]>): Identifier[] {
return response.data.map((rawIdentifier) => {
return response?.data.map((rawIdentifier) => {
return {
category: rawIdentifier.attributes.category,
value: rawIdentifier.attributes.value,
Expand Down
8 changes: 7 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"confirm": "Confirm",
"disconnect": "Disconnect",
"revert": "Revert",

"next": "Next",
"back": "Back",
"continue": "Continue",
Expand Down Expand Up @@ -1355,13 +1356,17 @@
"rejectRequest": "Reject request",
"acceptUpdate": "Accept update",
"rejectUpdate": "Reject update",
"acceptWithdrawal": "Accept withdrawal",
"rejectWithdrawal": "Reject withdrawal",
"withdrawRequest": "Withdraw Request",
"forceWithdraw": "Force Withdraw",
"forceWithdrawMessage": "Registration will be withdrawn but still have a tombstone page with a justification for withdrawal and a subset of the metadata available",
"acceptRequestMessage": "Submission will appear in search results and will be associated with the collection.",
"rejectRequestMessage": "Submission will not appear in search results nor will be associated with the collection.",
"acceptUpdateMessage": "Update will be accepted and registration will be updated",
"rejectUpdateMessage": "Update will be rejected and registration will remain unchanged",
"acceptWithdrawalMessage": "Registration will be withdrawn but still have a tombstone page with a justification for withdrawal and subset of the metadata available.",
"rejectWithdrawalMessage": "Submission will remain fully public",
"withdrawRequestMessage": "Submission will be withdrawn from the collection and will no longer appear in search results.",
"remarksPlaceholder": "Add remarks to registration admins (optional)",
"submitDecision": "Submit decision",
Expand All @@ -1381,7 +1386,8 @@
"requested": "Requested",
"withdrawn": "Withdrawn",
"by": "by",
"embargoEnding": "with embargo ending"
"embargoEnding": "with embargo ending",
"withdrawalRequested": "Registration withdrawal requested"
},
"preprintReviewStatus": {
"submitted": "submitted a preprint \"{{name}}\" to",
Expand Down
Loading