Bugfixes due to new slug signature (#145)

This commit is contained in:
Cássio Souza 2016-10-26 15:50:34 -02:00 committed by GitHub
parent 72b56d1cbc
commit 5151e7cdb1
3 changed files with 9 additions and 9 deletions

View File

@ -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;

View File

@ -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]
));
}

View File

@ -7,7 +7,7 @@ import { connect } from 'react-redux';
export default function EntryPageHOC(EntryPage) {
class EntryPageHOC extends React.Component {
render() {
return <EntryPage {...this.props}/>;
return <EntryPage {...this.props} />;
}
}
@ -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));
};