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) { editorialWorkflowGit(fileTree, entry, filesList, options) {
const contentKey = options.collectionName ? `${ options.collectionName }-${ entry.slug }` : entry.slug; const contentKey = entry.slug;
const branchName = `cms/${ contentKey }`; const branchName = `cms/${ contentKey }`;
const unpublished = options.unpublished || false; const unpublished = options.unpublished || false;
if (!unpublished) { if (!unpublished) {
// Open new editorial review workflow for this entry - Create new metadata and commit to new branch // 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 }`; const branchName = `cms/${ contentKey }`;
return this.getBranch() return this.getBranch()
@ -245,7 +245,7 @@ export default class API {
.then(branchData => this.updateTree(branchData.commit.sha, '/', fileTree)) .then(branchData => this.updateTree(branchData.commit.sha, '/', fileTree))
.then(changeTree => this.commit(options.commitMessage, changeTree)) .then(changeTree => this.commit(options.commitMessage, changeTree))
.then((response) => { .then((response) => {
const contentKey = options.collectionName ? `${ options.collectionName }-${ entry.slug }` : entry.slug; const contentKey = entry.slug;
const branchName = `cms/${ contentKey }`; const branchName = `cms/${ contentKey }`;
return this.user().then((user) => { return this.user().then((user) => {
return user.name ? user.name : user.login; return user.name ? user.name : user.login;

View File

@ -102,9 +102,9 @@ export default class GitHub {
unpublishedEntry(collection, slug) { unpublishedEntry(collection, slug) {
return this.unpublishedEntries().then(response => ( return this.unpublishedEntries().then(response => (
response.entries.filter(entry => ( response.entries.filter((entry) => {
entry.metaData && entry.metaData.collection === collection.get('name') && entry.slug === slug return entry.metaData && entry.slug === slug;
))[0] })[0]
)); ));
} }

View File

@ -32,7 +32,7 @@ export default function EntryPageHOC(EntryPage) {
if (unpublishedEntry) { if (unpublishedEntry) {
// Overwrite loadEntry to loadUnpublishedEntry // Overwrite loadEntry to loadUnpublishedEntry
const status = ownProps.params.status; const status = ownProps.params.status;
returnObj.loadEntry = (collection, slug) => { returnObj.loadEntry = (entry, collection, slug) => {
dispatch(loadUnpublishedEntry(collection, status, slug)); dispatch(loadUnpublishedEntry(collection, status, slug));
}; };