Skip to content

Commit 72a8d2f

Browse files
committed
Merge branch 'release/23.15.0'
2 parents 56e8128 + b08d4e6 commit 72a8d2f

File tree

124 files changed

+4774
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+4774
-465
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
19581958
### Added
19591959
- Quick Files
19601960

1961+
[23.15.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.15.0
19611962
[23.14.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.14.0
19621963
[23.13.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.13.0
19631964
[23.12.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.12.1

app/config/environment.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export interface KeenConfig {
1818
}
1919

2020
declare const config: {
21+
WATER_BUTLER_ENABLED: boolean;
22+
plauditWidgetUrl: string,
2123
environment: any;
2224
lintOnBuild: boolean;
2325
testsEnabled: boolean;
@@ -68,6 +70,7 @@ declare const config: {
6870
apiVersion: string;
6971
apiHeaders: { [k: string]: string };
7072
learnMoreUrl: string;
73+
donateUrl: string;
7174
renderUrl: string;
7275
waterbutlerUrl: string;
7376
helpUrl: string;
@@ -77,6 +80,7 @@ declare const config: {
7780
devMode: boolean;
7881
cookieDomain: string;
7982
authenticator: string;
83+
metricsStartDate: string;
8084
cookies: {
8185
status: string;
8286
keenUserId: string;

app/institutions/discover/controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
export default class InstitutionDiscoverController extends Controller {
1111
@service currentUser!: CurrentUser;
1212

13-
@tracked q?: string = '';
13+
@tracked cardSearchText?: string = '';
1414
@tracked sort?: string = '-relevance';
1515
@tracked resourceType: ResourceTypeFilterValue = ResourceTypeFilterValue.Projects;
1616
@tracked activeFilters?: Filter[] = [];

app/models/contributor.ts

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { not } from '@ember/object/computed';
33
import { buildValidations, validator } from 'ember-cp-validations';
44

55
import DraftRegistrationModel from './draft-registration';
6+
import PreprintModel from './preprint';
67
import NodeModel from './node';
78
import OsfModel, { Permission } from './osf-model';
89
import UserModel from './user';
@@ -53,6 +54,9 @@ export default class ContributorModel extends OsfModel.extend(Validations) {
5354
@belongsTo('node', { inverse: 'contributors', polymorphic: true })
5455
node!: AsyncBelongsTo<NodeModel> & NodeModel;
5556

57+
@belongsTo('preprint', { inverse: 'contributors'})
58+
preprint!: AsyncBelongsTo<PreprintModel> & PreprintModel;
59+
5660
@belongsTo('draft-registration', { inverse: 'contributors' })
5761
draftRegistration!: AsyncBelongsTo<DraftRegistrationModel> & DraftRegistrationModel;
5862

app/models/file-provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default class FileProviderModel extends BaseFileItem {
1919
@belongsTo('base-file-item', { polymorphic: true })
2020
rootFolder!: AsyncBelongsTo<FileModel> & FileModel;
2121

22-
@hasMany('file', { polymorphic: true })
22+
@hasMany('file', { inverse:'parentFolder', polymorphic: true })
2323
files!: AsyncHasMany<FileModel>;
2424

2525
@belongsTo('abstract-node', { inverse: 'files', polymorphic: true })

app/models/file.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Link } from 'jsonapi-typescript';
55
import { FileReference } from 'ember-osf-web/packages/registration-schema';
66
import getHref from 'ember-osf-web/utils/get-href';
77

8+
import PreprintModel from 'ember-osf-web/models/preprint';
89
import AbstractNodeModel from './abstract-node';
910
import BaseFileItem, { BaseFileLinks } from './base-file-item';
1011
import CommentModel from './comment';
@@ -56,8 +57,9 @@ export default class FileModel extends BaseFileItem {
5657
@hasMany('comment', { inverse: null })
5758
comments!: AsyncHasMany<CommentModel>;
5859

59-
@belongsTo('abstract-node', { polymorphic: true })
60-
target!: (AsyncBelongsTo<AbstractNodeModel> & AbstractNodeModel) | (AsyncBelongsTo<DraftNode> & DraftNode);
60+
@belongsTo('osf-model', { polymorphic: true })
61+
// eslint-disable-next-line max-len
62+
target!: (AsyncBelongsTo<AbstractNodeModel> & AbstractNodeModel) | (AsyncBelongsTo<PreprintModel> & PreprintModel) | (AsyncBelongsTo<DraftNode> & DraftNode);
6163

6264
// BaseFileItem override
6365
isFileModel = true;

app/models/preprint-provider.ts

+15-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const { defaultProvider } = config;
1818
export default class PreprintProviderModel extends ProviderModel {
1919
@service intl!: Intl;
2020

21+
@attr('fixstring') email_support!: string | null;
2122
@attr('array') subjectsAcceptable!: string[];
2223
@attr('array') additionalProviders!: string[];
2324
@attr('string') shareSource!: string;
@@ -52,23 +53,29 @@ export default class PreprintProviderModel extends ProviderModel {
5253
};
5354
}
5455

56+
get searchPlaceholder(): string {
57+
return this.intl.t('preprints.header.search_placeholder',
58+
{ placeholder: this.documentType.plural});
59+
}
60+
5561
@computed('id')
56-
get preprintWordInTitle() {
57-
return this.id !== 'thesiscommons';
62+
get preprintWordNotInTitle() {
63+
return this.id === 'thesiscommons';
5864
}
5965

6066
// Is either OSF Preprints if provider is the default provider,
6167
// name+preprintWord.pluralCapitalized(e.g.AfricArXiv Preprints or MarXiv Papers), or "Thesis Commons"
62-
@computed('documentType.pluralCapitalized', 'id', 'name', 'preprintWordInTitle')
68+
@computed('documentType.pluralCapitalized', 'id', 'name', 'preprintWordNotInTitle')
6369
get providerTitle() {
6470
if (this.id !== defaultProvider) {
65-
if (this.preprintWordInTitle) {
66-
return this.intl.t('preprints.provider-title',
67-
{ name: this.name, pluralizedPreprintWord: this.documentType.pluralCapitalized });
71+
if (this.preprintWordNotInTitle) {
72+
return this.name;
6873
}
69-
return this.name;
74+
return this.intl.t('preprints.provider-title',
75+
{ name: this.name, pluralizedPreprintWord: this.documentType.pluralCapitalized });
76+
} else {
77+
return this.intl.t('preprints.header.osf_preprints');
7078
}
71-
return this.intl.t('preprints.osf-title');
7279
}
7380
}
7481

app/models/preprint-request-action.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { AsyncBelongsTo, attr, belongsTo } from '@ember-data/model';
2+
import PreprintRequestModel from 'ember-osf-web/models/preprint-request';
3+
import UserModel from 'ember-osf-web/models/user';
4+
5+
import OsfModel from './osf-model';
6+
7+
8+
export enum PreprintRequestActionTriggerEnum {
9+
SUBMIT= 'submit',
10+
ACCEPT = 'accept',
11+
REJECT = 'reject',
12+
}
13+
14+
export default class PreprintRequestActionModel extends OsfModel {
15+
@attr('string') comment!: string;
16+
@attr('string') actionTrigger!: string;
17+
@attr('date') dateModified!: Date;
18+
@attr('boolean') auto!: boolean;
19+
20+
// Relationships
21+
@belongsTo('preprint-request', { inverse: 'actions' })
22+
target!: (AsyncBelongsTo<PreprintRequestModel> & PreprintRequestModel);
23+
24+
@belongsTo('user', { inverse: null, async: true })
25+
creator!: AsyncBelongsTo<UserModel> & UserModel;
26+
}
27+
28+
declare module 'ember-data/types/registries/model' {
29+
export default interface ModelRegistry {
30+
'preprint-request-action': PreprintRequestActionModel;
31+
} // eslint-disable-line semi
32+
}

app/models/preprint-request.ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { AsyncBelongsTo, SyncHasMany, attr, belongsTo, hasMany } from '@ember-data/model';
2+
import PreprintModel from 'ember-osf-web/models/preprint';
3+
import UserModel from 'ember-osf-web/models/user';
4+
import PreprintRequestActionModel from 'ember-osf-web/models/preprint-request-action';
5+
6+
import OsfModel from './osf-model';
7+
8+
export enum PreprintRequestType{
9+
WITHDRAWAL = 'withdrawal',
10+
}
11+
12+
export enum PreprintRequestMachineState {
13+
PENDING = 'pending',
14+
ACCEPTED = 'accepted',
15+
REJECTED = 'rejected',
16+
}
17+
18+
export default class PreprintRequestModel extends OsfModel {
19+
@attr('string') comment!: string;
20+
@attr('date') dateLastTransitioned!: Date;
21+
@attr('date') created!: Date;
22+
@attr('date') modified!: Date;
23+
@attr('string') machineState!: string;
24+
@attr('string') requestType!: string;
25+
26+
@belongsTo('preprint', { inverse: 'requests'})
27+
target!: (AsyncBelongsTo<PreprintModel> & PreprintModel);
28+
29+
@belongsTo('user', { inverse: null, async: true })
30+
creator!: AsyncBelongsTo<UserModel> & UserModel;
31+
32+
@hasMany('preprint-request-action', { inverse: 'target'})
33+
actions!: SyncHasMany<PreprintRequestActionModel> & PreprintRequestActionModel;
34+
}
35+
36+
declare module 'ember-data/types/registries/model' {
37+
export default interface ModelRegistry {
38+
'preprint-request': PreprintRequestModel;
39+
} // eslint-disable-line semi
40+
}

app/models/preprint.ts

+56-9
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,60 @@
1-
import { attr, belongsTo, hasMany, SyncHasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-data/model';
1+
import { attr, belongsTo, hasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-data/model';
22
import { computed } from '@ember/object';
33
import { alias } from '@ember/object/computed';
4+
import CitationModel from 'ember-osf-web/models/citation';
5+
import PreprintRequestModel from 'ember-osf-web/models/preprint-request';
6+
import { ReviewsState } from 'ember-osf-web/models/provider';
7+
import ReviewActionModel from 'ember-osf-web/models/review-action';
48

59
import ContributorModel from './contributor';
610
import FileModel from './file';
711
import LicenseModel from './license';
812
import NodeModel from './node';
9-
import OsfModel from './osf-model';
13+
import OsfModel, { Permission } from './osf-model';
1014
import PreprintProviderModel from './preprint-provider';
11-
import ReviewActionModel from './review-action';
1215
import SubjectModel from './subject';
1316

17+
export enum PreprintDataLinksEnum {
18+
AVAILABLE = 'available',
19+
YES = 'yes',
20+
NO = 'no',
21+
NOT_APPLICABLE = 'not_applicable',
22+
}
23+
24+
export enum PreprintPreregLinksEnum {
25+
AVAILABLE = 'available',
26+
YES = 'yes',
27+
NO = 'no',
28+
NOT_APPLICABLE = 'not_applicable',
29+
}
30+
1431
export default class PreprintModel extends OsfModel {
1532
@attr('fixstring') title!: string;
1633
@attr('date') dateCreated!: Date;
1734
@attr('date') datePublished!: Date;
35+
@attr('date') dateWithdrawn!: Date;
1836
@attr('date') originalPublicationDate!: Date | null;
1937
@attr('date') dateModified!: Date;
2038
@attr('fixstring') doi!: string | null;
39+
@attr('boolean') public!: boolean;
2140
@attr('boolean') isPublished!: boolean;
2241
@attr('boolean') isPreprintOrphan!: boolean;
2342
@attr('object') licenseRecord!: any;
24-
@attr('string') reviewsState!: string;
43+
@attr('string') reviewsState!: ReviewsState;
44+
@attr('string') description!: string;
2545
@attr('date') dateLastTransitioned!: Date;
2646
@attr('date') preprintDoiCreated!: Date;
47+
@attr('array') currentUserPermissions!: Permission[];
48+
@attr('fixstringarray') tags!: string[];
49+
@attr('fixstring') withdrawalJustification! : string;
50+
@attr('boolean') hasCoi!: boolean;
51+
@attr('string') hasDataLinks!: PreprintDataLinksEnum;
52+
@attr('string') hasPreregLinks!: PreprintPreregLinksEnum;
53+
@attr('string') conflictOfInterestStatement!: string;
54+
@attr('array') dataLinks!: string[];
55+
@attr('array') preregLinks!: string[];
56+
@attr('string') whyNoData!: string;
57+
@attr('string') whyNoPrereg!: string;
2758

2859
@belongsTo('node', { inverse: 'preprints' })
2960
node!: AsyncBelongsTo<NodeModel> & NodeModel;
@@ -37,18 +68,34 @@ export default class PreprintModel extends OsfModel {
3768
@belongsTo('preprint-provider', { inverse: 'preprints' })
3869
provider!: AsyncBelongsTo<PreprintProviderModel> & PreprintProviderModel;
3970

40-
@hasMany('review-action', { inverse: 'target' })
71+
@hasMany('review-action')
4172
reviewActions!: AsyncHasMany<ReviewActionModel>;
4273

43-
@hasMany('contributor')
44-
contributors!: AsyncHasMany<ContributorModel>;
74+
@hasMany('files', { inverse: 'target'})
75+
files!: AsyncHasMany<FileModel> & FileModel;
76+
77+
@hasMany('contributors', { inverse: 'preprint'})
78+
contributors!: AsyncHasMany<ContributorModel> & ContributorModel;
4579

46-
@hasMany('subject', { inverse: null, async: false })
47-
subjects!: SyncHasMany<SubjectModel>;
80+
@hasMany('contributor', { inverse: null })
81+
bibliographicContributors!: AsyncHasMany<ContributorModel>;
82+
83+
@belongsTo('citation', { inverse: null })
84+
citation!: AsyncBelongsTo<CitationModel>;
85+
86+
@hasMany('subject', { inverse: null})
87+
subjects!: AsyncHasMany<SubjectModel>;
88+
89+
@hasMany('preprint-request', { inverse: 'target'})
90+
requests!: AsyncHasMany<PreprintRequestModel>;
4891

4992
@alias('links.doi') articleDoiUrl!: string | null;
5093
@alias('links.preprint_doi') preprintDoiUrl!: string;
5194

95+
get isWithdrawn(): boolean{
96+
return this.dateWithdrawn !== null;
97+
}
98+
5299
@computed('license', 'licenseRecord')
53100
get licenseText(): string {
54101
const text = this.license.get('text') || '';

app/models/provider.ts

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { attr, hasMany, SyncHasMany, AsyncHasMany } from '@ember-data/model';
22
import { computed } from '@ember/object';
33

4+
import CitationStyleModel from './citation-style';
45
import LicenseModel from './license';
56
import ModeratorModel from './moderator';
67
import OsfModel from './osf-model';
@@ -20,6 +21,21 @@ export interface Assets {
2021
wide_white: string;
2122
}
2223

24+
export enum PreprintProviderReviewsWorkFlow{
25+
PRE_MODERATION = 'pre-moderation',
26+
POST_MODERATION = 'post-moderation'
27+
}
28+
29+
export enum ReviewsState {
30+
INITIAL = 'initial',
31+
PENDING = 'pending',
32+
ACCEPTED = 'accepted',
33+
REJECTED = 'rejected',
34+
PENDING_WITHDRAWAL = 'pendingWithdrawal',
35+
WITHDRAWAL_REJECTED = 'withdrawalRejected',
36+
WITHDRAWN = 'withdrawn',
37+
}
38+
2339
export enum ReviewPermissions {
2440
SetUpModeration = 'set_up_moderation',
2541
ViewSubmissions = 'view_submissions',
@@ -39,7 +55,6 @@ export enum ReviewPermissions {
3955
}
4056

4157
/* eslint-enable camelcase */
42-
4358
export default abstract class ProviderModel extends OsfModel {
4459
@attr('fixstring') name!: string;
4560
@attr('fixstring') description!: string;
@@ -54,7 +69,7 @@ export default abstract class ProviderModel extends OsfModel {
5469
@attr('boolean') allowCommenting!: boolean;
5570
@attr('boolean') allowUpdates!: boolean;
5671
@attr('array') permissions!: ReviewPermissions[];
57-
@attr('fixstring') reviewsWorkflow!: string | null;
72+
@attr('fixstring') reviewsWorkflow!: PreprintProviderReviewsWorkFlow | null;
5873
@attr('boolean') reviewsCommentsAnonymous!: boolean | null;
5974
@attr() assets?: Partial<Assets>; // TODO: camelize in transform
6075

@@ -70,6 +85,9 @@ export default abstract class ProviderModel extends OsfModel {
7085
@hasMany('moderator', { inverse: 'provider' })
7186
moderators!: AsyncHasMany<ModeratorModel> | ModeratorModel[];
7287

88+
@hasMany('citation-style', { inverse: null })
89+
citationStyles!: AsyncHasMany<CitationStyleModel> & CitationStyleModel[];
90+
7391
@computed('permissions')
7492
get currentUserCanReview() {
7593
if (this.permissions) {

app/models/review-action.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { attr, belongsTo, AsyncBelongsTo } from '@ember-data/model';
22
import { computed } from '@ember/object';
33
import { inject as service } from '@ember/service';
44
import Intl from 'ember-intl/services/intl';
5+
import PreprintModel from 'ember-osf-web/models/preprint';
56

67
import Action from './action';
78
import RegistrationModel, { RegistrationReviewStates } from './registration';
@@ -63,7 +64,8 @@ export default class ReviewActionModel extends Action {
6364
@attr('string') toState!: RegistrationReviewStates;
6465

6566
@belongsTo('registration', { inverse: 'reviewActions', polymorphic: true })
66-
target!: AsyncBelongsTo<RegistrationModel> & RegistrationModel;
67+
target!: (AsyncBelongsTo<RegistrationModel> & RegistrationModel
68+
) | (AsyncBelongsTo<PreprintModel> & PreprintModel);
6769

6870
@computed('actionTrigger')
6971
get triggerPastTense(): string {

app/models/user.ts

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const Validations = buildValidations({
5454
});
5555

5656
export interface UserLinks extends OsfLinks {
57+
html: Link;
5758
profile_image: Link; // eslint-disable-line camelcase
5859
}
5960

0 commit comments

Comments
 (0)