diff --git a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html
index 9c19352c6..318026f85 100644
--- a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html
+++ b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html
@@ -15,7 +15,7 @@
{{ actionLabel[action.toState] | translate }}
{{ action.dateModified | dateAgo }}
{{ 'moderation.submissionReview.by' | translate }}
- {{ action.creator.name }}
+ {{ action.creator?.name }}
@if (action.comment.length) {
- {{ action.comment }}
diff --git a/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.html b/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.html
index 4e07e2027..b6cfcac27 100644
--- a/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.html
+++ b/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.html
@@ -31,7 +31,7 @@
{{ submission().title }}
{{ registryActionLabel[action.toState] | translate }}
{{ action.dateModified | dateAgo }}
{{ 'moderation.submissionReview.by' | translate }}
- {{ action.creator.name }}
+ {{ action.creator?.name }}
@if (action.toState === registryActionState.Accepted) {
{{ 'moderation.withNoEmbargo' | translate }}
diff --git a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.html b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.html
index f0c2b3b36..c5c929c7e 100644
--- a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.html
+++ b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.html
@@ -15,7 +15,7 @@ {{ 'preprints.preprintStepper.review.sections.metadata.publicationCitation'
{{ 'preprints.details.originalPublicationDate' | translate }}
- {{ preprintValue.originalPublicationDate | date: 'MMM d, y, h:mm a' }}
+ {{ preprintValue.originalPublicationDate | date: 'MMMM d, y' }}
}
diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts
index 1d456a86b..4d57e1de4 100644
--- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts
+++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts
@@ -6,7 +6,9 @@ import { Card } from 'primeng/card';
import { ChangeDetectionStrategy, Component, effect, input, OnInit, signal } from '@angular/core';
-import { PreprintProviderDetails } from '@osf/features/preprints/models';
+import { ReviewsState } from '@osf/features/preprints/enums';
+import { Preprint, PreprintProviderDetails } from '@osf/features/preprints/models';
+import { PreprintStepperSelectors, SetInstitutionsChanged } from '@osf/features/preprints/store/preprint-stepper';
import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components';
import { ResourceType } from '@osf/shared/enums';
import { Institution } from '@osf/shared/models';
@@ -26,7 +28,7 @@ import {
})
export class PreprintsAffiliatedInstitutionsComponent implements OnInit {
provider = input.required();
- preprintId = input();
+ preprint = input.required();
selectedInstitutions = signal([]);
@@ -35,11 +37,13 @@ export class PreprintsAffiliatedInstitutionsComponent implements OnInit {
resourceInstitutions = select(InstitutionsSelectors.getResourceInstitutions);
areResourceInstitutionsLoading = select(InstitutionsSelectors.areResourceInstitutionsLoading);
areResourceInstitutionsSubmitting = select(InstitutionsSelectors.areResourceInstitutionsSubmitting);
+ institutionsChanged = select(PreprintStepperSelectors.getInstitutionsChanged);
private readonly actions = createDispatchMap({
fetchUserInstitutions: FetchUserInstitutions,
fetchResourceInstitutions: FetchResourceInstitutions,
updateResourceInstitutions: UpdateResourceInstitutions,
+ setInstitutionsChanged: SetInstitutionsChanged,
});
constructor() {
@@ -49,15 +53,24 @@ export class PreprintsAffiliatedInstitutionsComponent implements OnInit {
this.selectedInstitutions.set([...resourceInstitutions]);
}
});
+
+ effect(() => {
+ const userInstitutions = this.userInstitutions();
+ const isCreateFlow = this.preprint()?.reviewsState === ReviewsState.Initial;
+
+ if (userInstitutions.length > 0 && isCreateFlow && !this.institutionsChanged()) {
+ this.actions.setInstitutionsChanged(true);
+ this.onInstitutionsChange(userInstitutions);
+ }
+ });
}
ngOnInit() {
this.actions.fetchUserInstitutions();
- this.actions.fetchResourceInstitutions(this.preprintId()!, ResourceType.Preprint);
+ this.actions.fetchResourceInstitutions(this.preprint()!.id, ResourceType.Preprint);
}
onInstitutionsChange(institutions: Institution[]): void {
- this.selectedInstitutions.set(institutions);
- this.actions.updateResourceInstitutions(this.preprintId()!, ResourceType.Preprint, institutions);
+ this.actions.updateResourceInstitutions(this.preprint()!.id, ResourceType.Preprint, institutions);
}
}
diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.html b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.html
index dec11eca6..67e0dd488 100644
--- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.html
+++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.html
@@ -24,7 +24,7 @@ {{ 'shared.license.title' | translate }}
-
+
diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts
index 7bb5f5720..6dffe263b 100644
--- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts
+++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts
@@ -148,7 +148,13 @@ export class DeletePreprint {
}
export class SetCurrentFolder {
- static readonly type = '[Submit Preprint] Set Current Folder';
+ static readonly type = '[Preprint Stepper] Set Current Folder';
constructor(public folder: OsfFile | null) {}
}
+
+export class SetInstitutionsChanged {
+ static readonly type = '[Preprint Stepper] Set Institutions Changed';
+
+ constructor(public institutionsChanged: boolean) {}
+}
diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts
index f760130c0..49863430d 100644
--- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts
+++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts
@@ -16,4 +16,5 @@ export interface PreprintStepperStateModel {
currentFolder: OsfFile | null;
preprintProject: AsyncStateModel
;
hasBeenSubmitted: boolean;
+ institutionsChanged: boolean;
}
diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts
index b2c8852dc..c4195b83d 100644
--- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts
+++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts
@@ -87,4 +87,9 @@ export class PreprintStepperSelectors {
static getCurrentFolder(state: PreprintStepperStateModel) {
return state.currentFolder;
}
+
+ @Selector([PreprintStepperState])
+ static getInstitutionsChanged(state: PreprintStepperStateModel) {
+ return state.institutionsChanged;
+ }
}
diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts
index 1d9d31541..38e4e7dd4 100644
--- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts
+++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts
@@ -40,6 +40,7 @@ import {
ReuploadFile,
SaveLicense,
SetCurrentFolder,
+ SetInstitutionsChanged,
SetSelectedPreprintFileSource,
SetSelectedPreprintProviderId,
SubmitPreprint,
@@ -89,6 +90,7 @@ const DefaultState: PreprintStepperStateModel = {
},
hasBeenSubmitted: false,
currentFolder: null,
+ institutionsChanged: false,
};
@State({
@@ -525,4 +527,9 @@ export class PreprintStepperState {
setCurrentFolder(ctx: StateContext, action: SetCurrentFolder) {
ctx.patchState({ currentFolder: action.folder });
}
+
+ @Action(SetInstitutionsChanged)
+ setInstitutionsChanged(ctx: StateContext, action: SetInstitutionsChanged) {
+ ctx.patchState({ institutionsChanged: action.institutionsChanged });
+ }
}
diff --git a/src/app/features/preprints/store/preprint/preprint.state.ts b/src/app/features/preprints/store/preprint/preprint.state.ts
index f68e61b83..4e7a27651 100644
--- a/src/app/features/preprints/store/preprint/preprint.state.ts
+++ b/src/app/features/preprints/store/preprint/preprint.state.ts
@@ -1,4 +1,4 @@
-import { Action, State, StateContext, Store } from '@ngxs/store';
+import { Action, State, StateContext } from '@ngxs/store';
import { append, patch } from '@ngxs/store/operators';
import { tap } from 'rxjs';
@@ -32,7 +32,6 @@ import { DefaultState, PreprintStateModel } from './preprint.model';
})
@Injectable()
export class PreprintState {
- private store = inject(Store);
private preprintsService = inject(PreprintsService);
private fileService = inject(FilesService);
@@ -73,9 +72,9 @@ export class PreprintState {
tap((preprint) => {
ctx.setState(patch({ preprint: patch({ isLoading: false, data: preprint }) }));
if (!preprint.dateWithdrawn) {
- this.store.dispatch(new FetchPreprintFile());
+ ctx.dispatch(new FetchPreprintFile());
}
- this.store.dispatch(new FetchPreprintVersionIds());
+ ctx.dispatch(new FetchPreprintVersionIds());
}),
catchError((error) => handleSectionError(ctx, 'preprint', error))
);
@@ -90,7 +89,7 @@ export class PreprintState {
return this.fileService.getFileById(preprintFileId!).pipe(
tap((file) => {
ctx.setState(patch({ preprintFile: patch({ isLoading: false, data: file }) }));
- this.store.dispatch(new FetchPreprintFileVersions());
+ ctx.dispatch(new FetchPreprintFileVersions());
}),
catchError((error) => handleSectionError(ctx, 'preprintFile', error))
);
diff --git a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.html b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.html
index 8b4e8c8c0..67a1aa5c9 100644
--- a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.html
+++ b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.html
@@ -14,7 +14,7 @@
}
{{ action.dateModified | dateAgo }}
{{ 'moderation.submissionReview.by' | translate }}
- {{ action.creator.name }}
+ {{ action.creator?.name }}
@if (embargoEndDate) {
{{ 'moderation.submissionReview.embargoEnding' | translate }}
{{ embargoEndDate | date: 'shortDate' }}
diff --git a/src/app/shared/components/data-resources/data-resources.component.html b/src/app/shared/components/data-resources/data-resources.component.html
index 1dd648d0d..b7a706e9e 100644
--- a/src/app/shared/components/data-resources/data-resources.component.html
+++ b/src/app/shared/components/data-resources/data-resources.component.html
@@ -1,12 +1,12 @@