Skip to content

Commit

Permalink
fixup! fixup! feat: add initial workflow status in config
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainOliva committed Jun 6, 2022
1 parent 78cc7e0 commit ac67514
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions dev-test/backends/default-workflow-status/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
backend:
name: git-gateway
branch: master
name: test-repo

publish_mode: editorial_workflow
default_workflow_status: pending_publish
Expand Down
6 changes: 5 additions & 1 deletion packages/netlify-cms-core/src/actions/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ export function applyDefaults(originalConfig: CmsConfig) {
config.collections = config.collections || [];

if (config.publish_mode === EDITORIAL_WORKFLOW) {
config.default_workflow_status = config.default_workflow_status || Statues.DRAFT;
config.default_workflow_status =
config.default_workflow_status &&
Object.values(Statues).includes(config.default_workflow_status)
? config.default_workflow_status
: Statues.DRAFT;
}

// Use `site_url` as default `display_url`.
Expand Down
1 change: 0 additions & 1 deletion packages/netlify-cms-core/src/constants/publishModes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ export const statusDescriptions = Map({
});

export type Status = keyof typeof Statues;
export type StatusValues = typeof Statues[Status];
3 changes: 1 addition & 2 deletions packages/netlify-cms-core/src/types/redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Action } from 'redux';
import type { StaticallyTypedRecord } from './immutable';
import type { Map, List, OrderedMap, Set } from 'immutable';
import type { FILES, FOLDER } from '../constants/collectionTypes';
import type { StatusValues as PublishStatusValues } from '../constants/publishModes';
import type { MediaFile as BackendMediaFile } from '../backend';
import type { Auth } from '../reducers/auth';
import type { Status } from '../reducers/status';
Expand Down Expand Up @@ -401,7 +400,7 @@ export interface CmsConfig {
media_folder_relative?: boolean;
media_library?: CmsMediaLibrary;
publish_mode?: CmsPublishMode;
default_workflow_status?: PublishStatusValues;
default_workflow_status?: string;
load_config_file?: boolean;
integrations?: {
hooks: string[];
Expand Down

0 comments on commit ac67514

Please sign in to comment.