Skip to content

Commit

Permalink
Merge branch 'release/23.15.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
adlius committed Nov 30, 2023
2 parents 56e8128 + b08d4e6 commit 72a8d2f
Show file tree
Hide file tree
Showing 124 changed files with 4,774 additions and 465 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Quick Files

[23.15.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.15.0
[23.14.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.14.0
[23.13.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.13.0
[23.12.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.12.1
Expand Down
4 changes: 4 additions & 0 deletions app/config/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export interface KeenConfig {
}

declare const config: {
WATER_BUTLER_ENABLED: boolean;
plauditWidgetUrl: string,
environment: any;
lintOnBuild: boolean;
testsEnabled: boolean;
Expand Down Expand Up @@ -68,6 +70,7 @@ declare const config: {
apiVersion: string;
apiHeaders: { [k: string]: string };
learnMoreUrl: string;
donateUrl: string;
renderUrl: string;
waterbutlerUrl: string;
helpUrl: string;
Expand All @@ -77,6 +80,7 @@ declare const config: {
devMode: boolean;
cookieDomain: string;
authenticator: string;
metricsStartDate: string;
cookies: {
status: string;
keenUserId: string;
Expand Down
2 changes: 1 addition & 1 deletion app/institutions/discover/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
export default class InstitutionDiscoverController extends Controller {
@service currentUser!: CurrentUser;

@tracked q?: string = '';
@tracked cardSearchText?: string = '';
@tracked sort?: string = '-relevance';
@tracked resourceType: ResourceTypeFilterValue = ResourceTypeFilterValue.Projects;
@tracked activeFilters?: Filter[] = [];
Expand Down
4 changes: 4 additions & 0 deletions app/models/contributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { not } from '@ember/object/computed';
import { buildValidations, validator } from 'ember-cp-validations';

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

@belongsTo('preprint', { inverse: 'contributors'})
preprint!: AsyncBelongsTo<PreprintModel> & PreprintModel;

@belongsTo('draft-registration', { inverse: 'contributors' })
draftRegistration!: AsyncBelongsTo<DraftRegistrationModel> & DraftRegistrationModel;

Expand Down
2 changes: 1 addition & 1 deletion app/models/file-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class FileProviderModel extends BaseFileItem {
@belongsTo('base-file-item', { polymorphic: true })
rootFolder!: AsyncBelongsTo<FileModel> & FileModel;

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

@belongsTo('abstract-node', { inverse: 'files', polymorphic: true })
Expand Down
6 changes: 4 additions & 2 deletions app/models/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Link } from 'jsonapi-typescript';
import { FileReference } from 'ember-osf-web/packages/registration-schema';
import getHref from 'ember-osf-web/utils/get-href';

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

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

// BaseFileItem override
isFileModel = true;
Expand Down
23 changes: 15 additions & 8 deletions app/models/preprint-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const { defaultProvider } = config;
export default class PreprintProviderModel extends ProviderModel {
@service intl!: Intl;

@attr('fixstring') email_support!: string | null;
@attr('array') subjectsAcceptable!: string[];
@attr('array') additionalProviders!: string[];
@attr('string') shareSource!: string;
Expand Down Expand Up @@ -52,23 +53,29 @@ export default class PreprintProviderModel extends ProviderModel {
};
}

get searchPlaceholder(): string {
return this.intl.t('preprints.header.search_placeholder',
{ placeholder: this.documentType.plural});
}

@computed('id')
get preprintWordInTitle() {
return this.id !== 'thesiscommons';
get preprintWordNotInTitle() {
return this.id === 'thesiscommons';
}

// Is either OSF Preprints if provider is the default provider,
// name+preprintWord.pluralCapitalized(e.g.AfricArXiv Preprints or MarXiv Papers), or "Thesis Commons"
@computed('documentType.pluralCapitalized', 'id', 'name', 'preprintWordInTitle')
@computed('documentType.pluralCapitalized', 'id', 'name', 'preprintWordNotInTitle')
get providerTitle() {
if (this.id !== defaultProvider) {
if (this.preprintWordInTitle) {
return this.intl.t('preprints.provider-title',
{ name: this.name, pluralizedPreprintWord: this.documentType.pluralCapitalized });
if (this.preprintWordNotInTitle) {
return this.name;
}
return this.name;
return this.intl.t('preprints.provider-title',
{ name: this.name, pluralizedPreprintWord: this.documentType.pluralCapitalized });
} else {
return this.intl.t('preprints.header.osf_preprints');
}
return this.intl.t('preprints.osf-title');
}
}

Expand Down
32 changes: 32 additions & 0 deletions app/models/preprint-request-action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { AsyncBelongsTo, attr, belongsTo } from '@ember-data/model';
import PreprintRequestModel from 'ember-osf-web/models/preprint-request';
import UserModel from 'ember-osf-web/models/user';

import OsfModel from './osf-model';


export enum PreprintRequestActionTriggerEnum {
SUBMIT= 'submit',
ACCEPT = 'accept',
REJECT = 'reject',
}

export default class PreprintRequestActionModel extends OsfModel {
@attr('string') comment!: string;
@attr('string') actionTrigger!: string;
@attr('date') dateModified!: Date;
@attr('boolean') auto!: boolean;

// Relationships
@belongsTo('preprint-request', { inverse: 'actions' })
target!: (AsyncBelongsTo<PreprintRequestModel> & PreprintRequestModel);

@belongsTo('user', { inverse: null, async: true })
creator!: AsyncBelongsTo<UserModel> & UserModel;
}

declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
'preprint-request-action': PreprintRequestActionModel;
} // eslint-disable-line semi
}
40 changes: 40 additions & 0 deletions app/models/preprint-request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { AsyncBelongsTo, SyncHasMany, attr, belongsTo, hasMany } from '@ember-data/model';
import PreprintModel from 'ember-osf-web/models/preprint';
import UserModel from 'ember-osf-web/models/user';
import PreprintRequestActionModel from 'ember-osf-web/models/preprint-request-action';

import OsfModel from './osf-model';

export enum PreprintRequestType{
WITHDRAWAL = 'withdrawal',
}

export enum PreprintRequestMachineState {
PENDING = 'pending',
ACCEPTED = 'accepted',
REJECTED = 'rejected',
}

export default class PreprintRequestModel extends OsfModel {
@attr('string') comment!: string;
@attr('date') dateLastTransitioned!: Date;
@attr('date') created!: Date;
@attr('date') modified!: Date;
@attr('string') machineState!: string;
@attr('string') requestType!: string;

@belongsTo('preprint', { inverse: 'requests'})
target!: (AsyncBelongsTo<PreprintModel> & PreprintModel);

@belongsTo('user', { inverse: null, async: true })
creator!: AsyncBelongsTo<UserModel> & UserModel;

@hasMany('preprint-request-action', { inverse: 'target'})
actions!: SyncHasMany<PreprintRequestActionModel> & PreprintRequestActionModel;
}

declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
'preprint-request': PreprintRequestModel;
} // eslint-disable-line semi
}
65 changes: 56 additions & 9 deletions app/models/preprint.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
import { attr, belongsTo, hasMany, SyncHasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-data/model';
import { attr, belongsTo, hasMany, AsyncBelongsTo, AsyncHasMany } from '@ember-data/model';
import { computed } from '@ember/object';
import { alias } from '@ember/object/computed';
import CitationModel from 'ember-osf-web/models/citation';
import PreprintRequestModel from 'ember-osf-web/models/preprint-request';
import { ReviewsState } from 'ember-osf-web/models/provider';
import ReviewActionModel from 'ember-osf-web/models/review-action';

import ContributorModel from './contributor';
import FileModel from './file';
import LicenseModel from './license';
import NodeModel from './node';
import OsfModel from './osf-model';
import OsfModel, { Permission } from './osf-model';
import PreprintProviderModel from './preprint-provider';
import ReviewActionModel from './review-action';
import SubjectModel from './subject';

export enum PreprintDataLinksEnum {
AVAILABLE = 'available',
YES = 'yes',
NO = 'no',
NOT_APPLICABLE = 'not_applicable',
}

export enum PreprintPreregLinksEnum {
AVAILABLE = 'available',
YES = 'yes',
NO = 'no',
NOT_APPLICABLE = 'not_applicable',
}

export default class PreprintModel extends OsfModel {
@attr('fixstring') title!: string;
@attr('date') dateCreated!: Date;
@attr('date') datePublished!: Date;
@attr('date') dateWithdrawn!: Date;
@attr('date') originalPublicationDate!: Date | null;
@attr('date') dateModified!: Date;
@attr('fixstring') doi!: string | null;
@attr('boolean') public!: boolean;
@attr('boolean') isPublished!: boolean;
@attr('boolean') isPreprintOrphan!: boolean;
@attr('object') licenseRecord!: any;
@attr('string') reviewsState!: string;
@attr('string') reviewsState!: ReviewsState;
@attr('string') description!: string;
@attr('date') dateLastTransitioned!: Date;
@attr('date') preprintDoiCreated!: Date;
@attr('array') currentUserPermissions!: Permission[];
@attr('fixstringarray') tags!: string[];
@attr('fixstring') withdrawalJustification! : string;
@attr('boolean') hasCoi!: boolean;
@attr('string') hasDataLinks!: PreprintDataLinksEnum;
@attr('string') hasPreregLinks!: PreprintPreregLinksEnum;
@attr('string') conflictOfInterestStatement!: string;
@attr('array') dataLinks!: string[];
@attr('array') preregLinks!: string[];
@attr('string') whyNoData!: string;
@attr('string') whyNoPrereg!: string;

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

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

@hasMany('contributor')
contributors!: AsyncHasMany<ContributorModel>;
@hasMany('files', { inverse: 'target'})
files!: AsyncHasMany<FileModel> & FileModel;

@hasMany('contributors', { inverse: 'preprint'})
contributors!: AsyncHasMany<ContributorModel> & ContributorModel;

@hasMany('subject', { inverse: null, async: false })
subjects!: SyncHasMany<SubjectModel>;
@hasMany('contributor', { inverse: null })
bibliographicContributors!: AsyncHasMany<ContributorModel>;

@belongsTo('citation', { inverse: null })
citation!: AsyncBelongsTo<CitationModel>;

@hasMany('subject', { inverse: null})
subjects!: AsyncHasMany<SubjectModel>;

@hasMany('preprint-request', { inverse: 'target'})
requests!: AsyncHasMany<PreprintRequestModel>;

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

get isWithdrawn(): boolean{
return this.dateWithdrawn !== null;
}

@computed('license', 'licenseRecord')
get licenseText(): string {
const text = this.license.get('text') || '';
Expand Down
22 changes: 20 additions & 2 deletions app/models/provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { attr, hasMany, SyncHasMany, AsyncHasMany } from '@ember-data/model';
import { computed } from '@ember/object';

import CitationStyleModel from './citation-style';
import LicenseModel from './license';
import ModeratorModel from './moderator';
import OsfModel from './osf-model';
Expand All @@ -20,6 +21,21 @@ export interface Assets {
wide_white: string;
}

export enum PreprintProviderReviewsWorkFlow{
PRE_MODERATION = 'pre-moderation',
POST_MODERATION = 'post-moderation'
}

export enum ReviewsState {
INITIAL = 'initial',
PENDING = 'pending',
ACCEPTED = 'accepted',
REJECTED = 'rejected',
PENDING_WITHDRAWAL = 'pendingWithdrawal',
WITHDRAWAL_REJECTED = 'withdrawalRejected',
WITHDRAWN = 'withdrawn',
}

export enum ReviewPermissions {
SetUpModeration = 'set_up_moderation',
ViewSubmissions = 'view_submissions',
Expand All @@ -39,7 +55,6 @@ export enum ReviewPermissions {
}

/* eslint-enable camelcase */

export default abstract class ProviderModel extends OsfModel {
@attr('fixstring') name!: string;
@attr('fixstring') description!: string;
Expand All @@ -54,7 +69,7 @@ export default abstract class ProviderModel extends OsfModel {
@attr('boolean') allowCommenting!: boolean;
@attr('boolean') allowUpdates!: boolean;
@attr('array') permissions!: ReviewPermissions[];
@attr('fixstring') reviewsWorkflow!: string | null;
@attr('fixstring') reviewsWorkflow!: PreprintProviderReviewsWorkFlow | null;
@attr('boolean') reviewsCommentsAnonymous!: boolean | null;
@attr() assets?: Partial<Assets>; // TODO: camelize in transform

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

@hasMany('citation-style', { inverse: null })
citationStyles!: AsyncHasMany<CitationStyleModel> & CitationStyleModel[];

@computed('permissions')
get currentUserCanReview() {
if (this.permissions) {
Expand Down
4 changes: 3 additions & 1 deletion app/models/review-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { attr, belongsTo, AsyncBelongsTo } from '@ember-data/model';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
import Intl from 'ember-intl/services/intl';
import PreprintModel from 'ember-osf-web/models/preprint';

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

@belongsTo('registration', { inverse: 'reviewActions', polymorphic: true })
target!: AsyncBelongsTo<RegistrationModel> & RegistrationModel;
target!: (AsyncBelongsTo<RegistrationModel> & RegistrationModel
) | (AsyncBelongsTo<PreprintModel> & PreprintModel);

@computed('actionTrigger')
get triggerPastTense(): string {
Expand Down
1 change: 1 addition & 0 deletions app/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const Validations = buildValidations({
});

export interface UserLinks extends OsfLinks {
html: Link;
profile_image: Link; // eslint-disable-line camelcase
}

Expand Down
Loading

0 comments on commit 72a8d2f

Please sign in to comment.