fix(workflow): enable workflow per method (#1569)
Workflow needs to be enabled per method. `persistEntry` should only use it when persisting an unpublished entry, but must behave as if workflow were not enabled for publishing. This fixes a 2.0 regression.
This commit is contained in:
parent
f937d08747
commit
90b815657e
@ -43,7 +43,6 @@ export default class GitHub {
|
|||||||
repo: this.repo,
|
repo: this.repo,
|
||||||
api_root: this.api_root,
|
api_root: this.api_root,
|
||||||
squash_merges: this.squash_merges,
|
squash_merges: this.squash_merges,
|
||||||
useWorkflow: this.options.useWorkflow,
|
|
||||||
initialWorkflowStatus: this.options.initialWorkflowStatus,
|
initialWorkflowStatus: this.options.initialWorkflowStatus,
|
||||||
});
|
});
|
||||||
return this.api.user().then(user =>
|
return this.api.user().then(user =>
|
||||||
|
@ -134,7 +134,7 @@ export default class TestRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
persistEntry({ path, raw, slug }, mediaFiles = [], options = {}) {
|
persistEntry({ path, raw, slug }, mediaFiles = [], options = {}) {
|
||||||
if (this.options.useWorkflow) {
|
if (options.useWorkflow) {
|
||||||
const unpubStore = window.repoFilesUnpublished;
|
const unpubStore = window.repoFilesUnpublished;
|
||||||
const existingEntryIndex = unpubStore.findIndex(e => e.file.path === path);
|
const existingEntryIndex = unpubStore.findIndex(e => e.file.path === path);
|
||||||
if (existingEntryIndex >= 0) {
|
if (existingEntryIndex >= 0) {
|
||||||
|
@ -385,6 +385,8 @@ class Backend {
|
|||||||
|
|
||||||
const commitMessage = commitMessageFormatter(newEntry ? 'create' : 'update', config, { collection, slug: entryObj.slug, path: entryObj.path });
|
const commitMessage = commitMessageFormatter(newEntry ? 'create' : 'update', config, { collection, slug: entryObj.slug, path: entryObj.path });
|
||||||
|
|
||||||
|
const useWorkflow = config.getIn(["publish_mode"]) === EDITORIAL_WORKFLOW;
|
||||||
|
|
||||||
const collectionName = collection.get("name");
|
const collectionName = collection.get("name");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -397,6 +399,7 @@ class Backend {
|
|||||||
parsedData,
|
parsedData,
|
||||||
commitMessage,
|
commitMessage,
|
||||||
collectionName,
|
collectionName,
|
||||||
|
useWorkflow,
|
||||||
...updatedOptions
|
...updatedOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user