From 20d755f3dd5c797413177752884d8589c1f46931 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Fri, 7 Aug 2015 16:24:13 -0400 Subject: Changed post drafts to maintain a list of the names of uploading files instead of just a count --- web/react/stores/post_store.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/react/stores') diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index ea1e75ecb..044e7b300 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -155,7 +155,7 @@ var PostStore = assign({}, EventEmitter.prototype, { clearDraftUploads: function clearDraftUploads() { BrowserStore.actionOnItemsWithPrefix('draft_', function clearUploads(key, value) { if (value) { - value.uploadsInProgress = 0; + value.uploadsInProgress = []; BrowserStore.setItem(key, value); } }); @@ -163,7 +163,7 @@ var PostStore = assign({}, EventEmitter.prototype, { clearCommentDraftUploads: function clearCommentDraftUploads() { BrowserStore.actionOnItemsWithPrefix('comment_draft_', function clearUploads(key, value) { if (value) { - value.uploadsInProgress = 0; + value.uploadsInProgress = []; BrowserStore.setItem(key, value); } }); -- cgit v1.2.3-1-g7c22 From 17b05f705f910429ece1ca6c64ec56bf89dd014b Mon Sep 17 00:00:00 2001 From: hmhealey Date: Tue, 11 Aug 2015 09:41:18 -0400 Subject: Changed PostStore.getDraft/getCommentDraft to return an empty draft instead of null when no draft is found --- web/react/stores/post_store.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'web/react/stores') diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 044e7b300..9ebdf734c 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -132,25 +132,28 @@ var PostStore = assign({}, EventEmitter.prototype, { getSearchTerm: function getSearchTerm() { return BrowserStore.getItem('search_term'); }, + getEmptyDraft: function getEmptyDraft(draft) { + return {message: '', uploadsInProgress: [], previews: []}; + }, storeCurrentDraft: function storeCurrentDraft(draft) { var channelId = ChannelStore.getCurrentId(); BrowserStore.setItem('draft_' + channelId, draft); }, getCurrentDraft: function getCurrentDraft() { var channelId = ChannelStore.getCurrentId(); - return BrowserStore.getItem('draft_' + channelId); + return PostStore.getDraft(channelId); }, storeDraft: function storeDraft(channelId, draft) { BrowserStore.setItem('draft_' + channelId, draft); }, getDraft: function getDraft(channelId) { - return BrowserStore.getItem('draft_' + channelId); + return BrowserStore.getItem('draft_' + channelId, PostStore.getEmptyDraft()); }, storeCommentDraft: function storeCommentDraft(parentPostId, draft) { BrowserStore.setItem('comment_draft_' + parentPostId, draft); }, getCommentDraft: function getCommentDraft(parentPostId) { - return BrowserStore.getItem('comment_draft_' + parentPostId); + return BrowserStore.getItem('comment_draft_' + parentPostId, PostStore.getEmptyDraft()); }, clearDraftUploads: function clearDraftUploads() { BrowserStore.actionOnItemsWithPrefix('draft_', function clearUploads(key, value) { -- cgit v1.2.3-1-g7c22