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
1 change: 1 addition & 0 deletions src/app/core/guards/is-file.guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('isFileGuard', () => {
id: 'file-id',
type: CurrentResourceType.Files,
permissions: [],
redirectAutomatically: false,
...overrides,
});

Expand Down
1 change: 1 addition & 0 deletions src/app/core/guards/is-project.guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('isProjectGuard', () => {
id: 'resource-id',
type: CurrentResourceType.Projects,
permissions: [],
redirectAutomatically: false,
...overrides,
});

Expand Down
1 change: 1 addition & 0 deletions src/app/core/guards/is-registry.guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('isRegistryGuard', () => {
id: 'resource-id',
type: CurrentResourceType.Registrations,
permissions: [],
redirectAutomatically: false,
...overrides,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('MetadataRegistryInfoComponent', () => {
reviewsWorkflow: 'standard',
allowSubmissions: true,
allowUpdates: true,
redirectAutomatically: false,
};

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class PreprintProvidersMapper {
iri: response.links.iri,
faviconUrl: response.attributes.assets?.favicon,
squareColorNoTransparentImageUrl: response.attributes.assets?.square_color_no_transparent,
redirectAutomatically: response.attributes.redirect_automatically,
redirectUrl: response.links.redirect_url,
reviewsWorkflow: response.attributes.reviews_workflow,
facebookAppId: response.attributes.facebook_app_id,
reviewsCommentsPrivate: response.attributes.reviews_comments_private,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface PreprintProviderAttributesJsonApi {
name: string;
permissions: ReviewPermissions[];
preprint_word: PreprintWord;
redirect_automatically: boolean;
reviews_comments_anonymous: StringOrNull;
reviews_comments_private: StringOrNull;
reviews_workflow: ProviderReviewsWorkflow | null;
Expand Down
2 changes: 2 additions & 0 deletions src/app/features/preprints/models/preprint-provider.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export interface PreprintProviderDetails {
faviconUrl: string;
squareColorNoTransparentImageUrl: string;
facebookAppId: StringOrNull;
redirectAutomatically: boolean;
redirectUrl?: string;
reviewsCommentsPrivate: StringOrNull;
reviewsCommentsAnonymous: StringOrNull;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('RegistryProviderHeroComponent', () => {
reviewsWorkflow: '',
allowSubmissions: false,
allowUpdates: true,
redirectAutomatically: false,
};

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const MOCK_PROVIDER: RegistryProviderDetails = {
reviewsWorkflow: 'pre-moderation',
allowSubmissions: true,
allowUpdates: true,
redirectAutomatically: false,
};

describe('RegistriesProviderSearchComponent', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/mappers/collections/collections.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class CollectionsMapper {
shareSource: response.attributes.share_source,
sharePublishType: response.attributes.share_publish_type,
permissions: response.attributes.permissions,
redirectAutomatically: response.attributes.redirect_automatically,
redirectUrl: response.links?.redirect_url,
reviewsWorkflow: response.attributes.reviews_workflow,
primaryCollection: {
id: response.relationships.primary_collection.data!.id,
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/mappers/registration-provider.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class RegistrationProviderMapper {
reviewsWorkflow: response.attributes.reviews_workflow,
allowSubmissions: response.attributes.allow_submissions,
allowUpdates: response.attributes.allow_updates,
redirectAutomatically: response.attributes.redirect_automatically,
redirectUrl: response.links.redirect_url,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface CollectionProviderDataJsonApi extends JsonApiResource<
> {
embeds: CollectionProviderEmbedsJsonApi;
relationships: CollectionProviderRelationshipsJsonApi;
links?: Pick<ResourceLinksJsonApi, 'iri'>;
links?: Pick<ResourceLinksJsonApi, 'iri' | 'self' | 'redirect_url'>;
}

interface CollectionProviderEmbedsJsonApi {
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/models/common/json-api/links.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface ResourceLinksJsonApi {
html: string;
self: string;
iri: string;
redirect_url?: string;
}

export interface PaginationLinks {
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/models/current-resource.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface CurrentResource {
wikiEnabled?: boolean;
permissions: UserPermissions[];
title?: string;
redirectUrl?: string;
redirectAutomatically: boolean;
}
2 changes: 2 additions & 0 deletions src/app/shared/models/files/file-json-api.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface BaseFileAttributesJsonApi {
name: string;
path: string;
provider: string;
redirect_automatically: boolean;
size: number;
}

Expand Down Expand Up @@ -68,6 +69,7 @@ export interface FileLinksJsonApi {
render: string;
self: string;
upload: string;
redirect_url: string;
}

interface FileEmbedsJsonApi {
Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/models/guid-response-json-api.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { UserPermissions } from '../enums/user-permissions.enum';

import { ResourceLinksJsonApi } from './common/json-api/links.model';
import { ToOneRel } from './common/json-api/relationships.model';
import { JsonApiResource } from './common/json-api/resource.model';
import { ItemResponse } from './common/json-api/responses.model';
Expand All @@ -8,11 +9,13 @@ export type GuidedResponseJsonApi = ItemResponse<GuidDataJsonApi>;

export interface GuidDataJsonApi extends JsonApiResource<string, GuidAttributesJsonApi> {
relationships: GuidRelationshipsJsonApi;
links: ResourceLinksJsonApi;
}

interface GuidAttributesJsonApi {
current_user_permissions: UserPermissions[];
guid: string;
redirect_automatically: boolean;
title?: string;
wiki_enabled: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface BaseNodeAttributesJsonApi {
node_license: LicenseRecordJsonApi | null;
preprint: boolean;
public: boolean;
redirect_automatically: boolean;
registration: boolean;
tags: string[];
title: string;
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/models/preprints/preprint-json-api.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface PreprintAttributesJsonApi {
prereg_links: string[];
preprint_doi_created: Date | null;
public: boolean;
redirect_automatically: boolean;
reviews_state: ReviewsState;
tags: string[];
title: string;
Expand Down Expand Up @@ -80,4 +81,5 @@ interface PreprintMetaJsonApi {
interface PreprintLinksJsonApi {
doi: string;
preprint_doi: string;
redirect_url?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface BaseProviderAttributesJsonApi {
footer_links: string;
name: string;
permissions: ReviewPermissions[];
redirect_automatically: boolean;
reviews_workflow: string;
share_publish_type: string;
share_source: string;
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/models/provider/provider.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface BaseProviderModel {
footerLinks: string;
name: string;
permissions: ReviewPermissions[];
redirectAutomatically: boolean;
redirectUrl?: string;
reviewsWorkflow: string;
sharePublishType: string;
shareSource: string;
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/models/provider/registry-provider.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ export interface RegistryProviderDetails {
reviewsWorkflow: string;
allowSubmissions: boolean;
allowUpdates: boolean;
redirectAutomatically: boolean;
redirectUrl?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.e
import { UserPermissions } from '@osf/shared/enums/user-permissions.enum';

import { EmbedList } from '../common/json-api/embeds.model';
import { ResourceLinksJsonApi } from '../common/json-api/links.model';
import { RelatedCountRel, ToOneRel, ToOneRelData } from '../common/json-api/relationships.model';
import { JsonApiResource, JsonApiResourceRef } from '../common/json-api/resource.model';
import { ItemResponse, ListResponse } from '../common/json-api/responses.model';
Expand All @@ -28,6 +29,7 @@ export interface DraftRegistrationDataJsonApi extends JsonApiResource<
export interface RegistrationDataJsonApi extends JsonApiResource<'registrations', RegistrationNodeAttributesJsonApi> {
relationships: RegistrationRelationshipsJsonApi;
embeds?: RegistrationEmbedsJsonApi;
links: ResourceLinksJsonApi;
}

export interface CreateRegistrationPayloadJsonApi {
Expand Down Expand Up @@ -88,6 +90,7 @@ export interface RegistrationAttributesJsonApi {
pending_embargo_termination_approval: boolean;
pending_registration_approval: boolean;
public: boolean;
redirect_automatically: boolean;
revision_state: RevisionReviewStates;
reviews_state: RegistrationReviewStates;
title: string;
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/services/resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class ResourceGuidService {
: res.data.relationships.target?.data?.type,
wikiEnabled: res.data.attributes.wiki_enabled,
permissions: res.data.attributes.current_user_permissions,
redirectAutomatically: res.data.attributes.redirect_automatically,
redirectUrl: res.data.links.redirect_url,
rootResourceId: res.data.relationships.root?.data?.id,
title: res.data.attributes?.title,
}) as CurrentResource
Expand Down
2 changes: 2 additions & 0 deletions src/testing/mocks/preprint-provider-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const PREPRINT_PROVIDER_DETAILS_MOCK: PreprintProviderDetails = {
faviconUrl: 'https://osf.io/favicon.ico',
squareColorNoTransparentImageUrl: 'https://osf.io/image.png',
facebookAppId: '1234567890',
redirectAutomatically: false,
redirectUrl: 'https://osf.io/redirect',
reviewsCommentsPrivate: null,
reviewsCommentsAnonymous: null,
lastFetched: Date.now(),
Expand Down
Loading