fix(backend-github): prepend collection name (#2878)
* fix(backend-github): prepend collection name * chore: prefer migrating entries * chore: cleanup * chore: move migration to listUnpublishedBranches * chore: prefer flowAsync * chore: feedback updates * refactor: extract current metadata version to a const * refactor: don't send pulls request on open authoring * test: update recorded data * fix: hardcode migration key/branch logic * test(backend-github): add unit tests for migration code * fix(github-graphql): add ref property to result of createBranch * test(cypress): update recorded data * fix: load unpublished entries once * fix: run migration for published draft entry * fix: failing test * chore: use hardcoded version number * fix: use hardcoded version number * test(cypress): update recorded data
This commit is contained in:
@ -57,6 +57,9 @@ describe('editorialWorkflow actions', () => {
|
||||
mediaLibrary: fromJS({
|
||||
isLoading: false,
|
||||
}),
|
||||
editorialWorkflow: fromJS({
|
||||
pages: { ids: [] },
|
||||
}),
|
||||
});
|
||||
|
||||
currentBackend.mockReturnValue(backend);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import uuid from 'uuid/v4';
|
||||
import { get } from 'lodash';
|
||||
import { actions as notifActions } from 'redux-notifications';
|
||||
import { BEGIN, COMMIT, REVERT } from 'redux-optimist';
|
||||
import { serializeValues } from 'Lib/serializeEntryValues';
|
||||
@ -242,6 +243,12 @@ export function loadUnpublishedEntry(collection, slug) {
|
||||
return async (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const backend = currentBackend(state.config);
|
||||
const entriesLoaded = get(state.editorialWorkflow.toJS(), 'pages.ids', false);
|
||||
//run possible unpublishedEntries migration
|
||||
if (!entriesLoaded) {
|
||||
const response = await backend.unpublishedEntries(state.collections).catch(() => false);
|
||||
response && dispatch(unpublishedEntriesLoaded(response.entries, response.pagination));
|
||||
}
|
||||
|
||||
dispatch(unpublishedEntryLoading(collection, slug));
|
||||
|
||||
@ -294,8 +301,10 @@ export function loadUnpublishedEntry(collection, slug) {
|
||||
export function loadUnpublishedEntries(collections) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
if (state.config.get('publish_mode') !== EDITORIAL_WORKFLOW) return;
|
||||
const backend = currentBackend(state.config);
|
||||
const entriesLoaded = get(state.editorialWorkflow.toJS(), 'pages.ids', false);
|
||||
if (state.config.get('publish_mode') !== EDITORIAL_WORKFLOW || entriesLoaded) return;
|
||||
|
||||
dispatch(unpublishedEntriesLoading());
|
||||
backend
|
||||
.unpublishedEntries(collections)
|
||||
|
Reference in New Issue
Block a user