Merge pull request #611 from outline/issue-drafts

Drafts Fixes
This commit is contained in:
Tom Moor
2018-02-28 23:27:56 -08:00
committed by GitHub
3 changed files with 7 additions and 4 deletions

View File

@@ -3,9 +3,10 @@ import localForage from 'localforage';
class CacheStore {
key: string;
version: number = 1;
cacheKey = (key: string): string => {
return `CACHE_${this.key}_${key}`;
return `CACHE_${this.key}_${this.version}_${key}`;
};
getItem = (key: string): any => {

View File

@@ -63,8 +63,8 @@
"dependencies": {
"@tommoor/slate-drop-or-paste-images": "^0.8.1",
"@tommoor/slate-edit-code": "^0.13.3",
"aws-sdk": "^2.135.0",
"autotrack": "^2.4.1",
"aws-sdk": "^2.135.0",
"babel-core": "^6.24.1",
"babel-eslint": "^8.1.2",
"babel-loader": "^7.1.2",
@@ -205,5 +205,6 @@
"prettier": "1.8.2",
"raf": "^3.4.0",
"react-test-renderer": "^16.1.0"
}
},
"version": "0.2.0"
}

View File

@@ -286,6 +286,7 @@ router.post('documents.update', auth(), async ctx => {
}
// Update document
const previouslyPublished = !!document.publishedAt;
if (publish) document.publishedAt = new Date();
if (title) document.title = title;
if (text) document.text = text;
@@ -294,7 +295,7 @@ router.post('documents.update', auth(), async ctx => {
await document.save();
const collection = document.collection;
if (collection.type === 'atlas') {
if (document.publishedAt) {
if (previouslyPublished) {
await collection.updateDocument(document);
} else if (publish) {
await collection.addDocumentToStructure(document);