From 5151e7cdb1a8ef96d4d3a33120ebdc2d5d54f53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A1ssio=20Souza?= Date: Wed, 26 Oct 2016 15:50:34 -0200 Subject: [PATCH] Bugfixes due to new slug signature (#145) --- src/backends/github/API.js | 6 +++--- src/backends/github/implementation.js | 6 +++--- src/containers/editorialWorkflow/EntryPageHOC.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backends/github/API.js b/src/backends/github/API.js index 31efefbb..606debbd 100644 --- a/src/backends/github/API.js +++ b/src/backends/github/API.js @@ -202,13 +202,13 @@ export default class API { } editorialWorkflowGit(fileTree, entry, filesList, options) { - const contentKey = options.collectionName ? `${ options.collectionName }-${ entry.slug }` : entry.slug; + const contentKey = entry.slug; const branchName = `cms/${ contentKey }`; const unpublished = options.unpublished || false; if (!unpublished) { // Open new editorial review workflow for this entry - Create new metadata and commit to new branch - const contentKey = options.collectionName ? `${ options.collectionName }-${ entry.slug }` : entry.slug; + const contentKey = entry.slug; const branchName = `cms/${ contentKey }`; return this.getBranch() @@ -245,7 +245,7 @@ export default class API { .then(branchData => this.updateTree(branchData.commit.sha, '/', fileTree)) .then(changeTree => this.commit(options.commitMessage, changeTree)) .then((response) => { - const contentKey = options.collectionName ? `${ options.collectionName }-${ entry.slug }` : entry.slug; + const contentKey = entry.slug; const branchName = `cms/${ contentKey }`; return this.user().then((user) => { return user.name ? user.name : user.login; diff --git a/src/backends/github/implementation.js b/src/backends/github/implementation.js index 7283cf81..5015ea25 100644 --- a/src/backends/github/implementation.js +++ b/src/backends/github/implementation.js @@ -102,9 +102,9 @@ export default class GitHub { unpublishedEntry(collection, slug) { return this.unpublishedEntries().then(response => ( - response.entries.filter(entry => ( - entry.metaData && entry.metaData.collection === collection.get('name') && entry.slug === slug - ))[0] + response.entries.filter((entry) => { + return entry.metaData && entry.slug === slug; + })[0] )); } diff --git a/src/containers/editorialWorkflow/EntryPageHOC.js b/src/containers/editorialWorkflow/EntryPageHOC.js index 4f38e293..486b8779 100644 --- a/src/containers/editorialWorkflow/EntryPageHOC.js +++ b/src/containers/editorialWorkflow/EntryPageHOC.js @@ -7,7 +7,7 @@ import { connect } from 'react-redux'; export default function EntryPageHOC(EntryPage) { class EntryPageHOC extends React.Component { render() { - return ; + return ; } } @@ -20,7 +20,7 @@ export default function EntryPageHOC(EntryPage) { if (isEditorialWorkflow && unpublishedEntry) { const status = ownProps.params.status; const slug = ownProps.params.slug; - const entry = selectUnpublishedEntry(state, status, slug); + const entry = selectUnpublishedEntry(state, status, slug); returnObj.entry = entry; } return returnObj; @@ -32,7 +32,7 @@ export default function EntryPageHOC(EntryPage) { if (unpublishedEntry) { // Overwrite loadEntry to loadUnpublishedEntry const status = ownProps.params.status; - returnObj.loadEntry = (collection, slug) => { + returnObj.loadEntry = (entry, collection, slug) => { dispatch(loadUnpublishedEntry(collection, status, slug)); };