Skip to content

Commit 9d03a1a

Browse files
committed
Merge branch 'release/24.06.0'
2 parents 38a84e7 + f4d06a4 commit 9d03a1a

File tree

12 files changed

+48
-24
lines changed

12 files changed

+48
-24
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [24.06.0] - 2024-08-21
8+
### Added
9+
- Misc bug and a11y fixes
10+
- Added route for My Preprints page
11+
712
## [24.05.0] - 2024-07-08
813
### Added
914
- Add subjects to project metadata editor

app/models/abstract-node.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { hasMany, AsyncHasMany, attr } from '@ember-data/model';
2-
2+
import { PromiseManyArray } from '@ember-data/store/-private';
33
import BaseFileItem from 'ember-osf-web/models/base-file-item';
44
import DraftRegistrationModel from 'ember-osf-web/models/draft-registration';
55
import FileProviderModel from 'ember-osf-web/models/file-provider';
6-
6+
import ReviewActionModel from 'ember-osf-web/models/review-action';
77
import { Permission } from './osf-model';
88

99
export default class AbstractNodeModel extends BaseFileItem {
@@ -15,6 +15,9 @@ export default class AbstractNodeModel extends BaseFileItem {
1515

1616
@attr('array') currentUserPermissions!: Permission[];
1717

18+
@hasMany('review-action', { inverse: 'target' })
19+
reviewActions!: PromiseManyArray<ReviewActionModel>;
20+
1821
}
1922

2023
declare module 'ember-data/types/registries/model' {

app/models/preprint.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import AbstractNodeModel from 'ember-osf-web/models/abstract-node';
55
import CitationModel from 'ember-osf-web/models/citation';
66
import PreprintRequestModel from 'ember-osf-web/models/preprint-request';
77
import { ReviewsState } from 'ember-osf-web/models/provider';
8-
import ReviewActionModel from 'ember-osf-web/models/review-action';
98

109
import ContributorModel from './contributor';
1110
import FileModel from './file';
@@ -82,9 +81,6 @@ export default class PreprintModel extends AbstractNodeModel {
8281
@belongsTo('preprint-provider', { inverse: 'preprints' })
8382
provider!: AsyncBelongsTo<PreprintProviderModel> & PreprintProviderModel;
8483

85-
@hasMany('review-action')
86-
reviewActions!: AsyncHasMany<ReviewActionModel>;
87-
8884
@hasMany('contributors', { inverse: 'preprint'})
8985
contributors!: AsyncHasMany<ContributorModel> & ContributorModel;
9086

app/models/registration.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { buildValidations, validator } from 'ember-cp-validations';
33

44
import DraftRegistrationModel from 'ember-osf-web/models/draft-registration';
55
import ResourceModel from 'ember-osf-web/models/resource';
6-
import ReviewActionModel, { ReviewActionTrigger } from 'ember-osf-web/models/review-action';
6+
import { ReviewActionTrigger } from 'ember-osf-web/models/review-action';
77
import SchemaResponseModel, { RevisionReviewStates } from 'ember-osf-web/models/schema-response';
88
import { RegistrationResponse } from 'ember-osf-web/packages/registration-schema';
99

@@ -149,9 +149,6 @@ export default class RegistrationModel extends NodeModel.extend(Validations) {
149149
@hasMany('institution', { inverse: 'registrations' })
150150
affiliatedInstitutions!: AsyncHasMany<InstitutionModel> | InstitutionModel[];
151151

152-
@hasMany('review-action', { inverse: 'target' })
153-
reviewActions!: AsyncHasMany<ReviewActionModel> | ReviewActionModel[];
154-
155152
@hasMany('schema-response', { inverse: 'registration' })
156153
schemaResponses!: AsyncHasMany<SchemaResponseModel> | SchemaResponseModel[];
157154

app/models/review-action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default class ReviewActionModel extends Action {
6363
@attr('string') fromState!: RegistrationReviewStates;
6464
@attr('string') toState!: RegistrationReviewStates;
6565

66-
@belongsTo('registration', { inverse: 'reviewActions', polymorphic: true })
66+
@belongsTo('abstract-node', { inverse: 'reviewActions', polymorphic: true })
6767
target!: (AsyncBelongsTo<RegistrationModel> & RegistrationModel
6868
) | (AsyncBelongsTo<PreprintModel> & PreprintModel);
6969

app/preprints/-components/submit/preprint-state-machine/component.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,19 @@ export default class PreprintStateMachine extends Component<StateMachineArgs>{
201201
@waitFor
202202
public async onSubmit(): Promise<void> {
203203
this.args.resetPageDirty();
204-
if (!this.isEditFlow) {
205-
if (this.provider.reviewsWorkflow) {
206-
const reviewAction = this.store.createRecord('review-action', {
207-
actionTrigger: 'submit',
208-
target: this.preprint,
209-
});
210-
await reviewAction.save();
211-
} else {
212-
this.preprint.isPublished = true;
213-
await this.preprint.save();
214-
}
204+
if (this.provider.reviewsWorkflow) {
205+
const reviewAction = this.store.createRecord('review-action', {
206+
actionTrigger: 'submit',
207+
target: this.preprint,
208+
});
209+
await reviewAction.save();
210+
} else {
211+
this.preprint.isPublished = true;
212+
await this.preprint.save();
215213
}
216214

215+
await this.preprint.reload();
216+
217217
await this.router.transitionTo('preprints.detail', this.provider.id, this.preprint.id);
218218
}
219219

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div data-analytics-scope='my-preprints'>
2+
{{outlet}}
3+
</div>

app/router.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Router.map(function() {
3434
this.route('submit', { path: '/:provider_id/submit' });
3535
this.route('edit', { path: '/:provider_id/edit/:guid' });
3636
this.route('select');
37+
this.route('my-preprints');
3738
});
3839

3940

mirage/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import {
4646
claimUnregisteredUser,
4747
userNodeList,
4848
userRegistrationList,
49+
userPreprintList,
4950
} from './views/user';
5051
import { updatePassword } from './views/user-password';
5152
import * as userSettings from './views/user-setting';
@@ -312,6 +313,7 @@ export default function(this: Server) {
312313
this.get('/users/:id/nodes', userNodeList);
313314
this.get('/sparse/users/:id/nodes', userNodeList);
314315
this.get('/users/:id/registrations', userRegistrationList);
316+
this.get('/users/:id/preprints', userPreprintList);
315317
osfNestedResource(this, 'user', 'draftRegistrations', {
316318
only: ['index'],
317319
});

mirage/views/user.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ export function userRegistrationList(this: HandlerContext, schema: Schema, reque
3030
return json;
3131
}
3232

33+
export function userPreprintList(this: HandlerContext, schema: Schema, request: Request) {
34+
const user = schema.users.find(request.params.id);
35+
const preprints = [];
36+
const { contributorIds } = user;
37+
38+
for (const contributorId of contributorIds as string[]) {
39+
const contributor = schema.contributors.find(contributorId);
40+
const preprint = contributor.preprint;
41+
if (preprint && filter(preprint, request)) {
42+
preprints.push(this.serialize(preprint).data);
43+
}
44+
}
45+
46+
const json = process(schema, request, this, preprints, { defaultSortKey: 'last_logged' });
47+
return json;
48+
}
49+
3350
export function claimUnregisteredUser(this: HandlerContext) {
3451
return new Response(204);
3552
}

0 commit comments

Comments
 (0)