Label cards in editorial workflow
This commit is contained in:
@ -159,7 +159,7 @@ export default class API {
|
||||
}
|
||||
|
||||
readUnpublishedBranchFile(contentKey) {
|
||||
let metaData;
|
||||
let metaData, fileData;
|
||||
const unpublishedPromise = this.retrieveMetadata(contentKey)
|
||||
.then((data) => {
|
||||
metaData = data;
|
||||
@ -168,13 +168,28 @@ export default class API {
|
||||
}
|
||||
return Promise.reject(null);
|
||||
})
|
||||
.then(fileData => ({ metaData, fileData }))
|
||||
.then((file) => {
|
||||
fileData = file;
|
||||
return this.isUnpublishedEntryModification(metaData.objects.entry.path);
|
||||
})
|
||||
.then(isModification => ({ metaData, fileData, isModification }))
|
||||
.catch(() => {
|
||||
throw new EditorialWorkflowError('content is not under editorial workflow', true);
|
||||
});
|
||||
return unpublishedPromise;
|
||||
}
|
||||
|
||||
isUnpublishedEntryModification(path, branch) {
|
||||
return this.readFile(path, null, branch)
|
||||
.then(data => true)
|
||||
.catch((err) => {
|
||||
if (err.message && err.message === "Not Found") {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
listUnpublishedBranches() {
|
||||
console.log("%c Checking for Unpublished entries", "line-height: 30px;text-align: center;font-weight: bold"); // eslint-disable-line
|
||||
return this.request(`${ this.repoURL }/git/refs/heads/cms`)
|
||||
|
@ -99,6 +99,7 @@ export default class GitHub {
|
||||
file: { path },
|
||||
data: data.fileData,
|
||||
metaData: data.metaData,
|
||||
isModification: data.isModification,
|
||||
});
|
||||
sem.leave();
|
||||
}
|
||||
@ -127,6 +128,7 @@ export default class GitHub {
|
||||
file: { path: data.metaData.objects.entry.path },
|
||||
data: data.fileData,
|
||||
metaData: data.metaData,
|
||||
isModification: data.isModification,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user