summaryrefslogtreecommitdiffstats
path: root/web/react/stores/post_store.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/stores/post_store.jsx')
-rw-r--r--web/react/stores/post_store.jsx28
1 files changed, 20 insertions, 8 deletions
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx
index 1b3e1a119..0745fcdc3 100644
--- a/web/react/stores/post_store.jsx
+++ b/web/react/stores/post_store.jsx
@@ -149,19 +149,23 @@ var PostStore = assign({}, EventEmitter.prototype, {
},
storeCurrentDraft: function(draft) {
var channel_id = ChannelStore.getCurrentId();
- var user_id = UserStore.getCurrentId();
- BrowserStore.setItem("draft_" + channel_id + "_" + user_id, draft);
+ BrowserStore.setItem("draft_" + channel_id, draft);
},
getCurrentDraft: function() {
var channel_id = ChannelStore.getCurrentId();
- var user_id = UserStore.getCurrentId();
- return BrowserStore.getItem("draft_" + channel_id + "_" + user_id);
+ return BrowserStore.getItem("draft_" + channel_id);
},
- storeDraft: function(channel_id, user_id, draft) {
- BrowserStore.setItem("draft_" + channel_id + "_" + user_id, draft);
+ storeDraft: function(channel_id, draft) {
+ BrowserStore.setItem("draft_" + channel_id, draft);
},
- getDraft: function(channel_id, user_id) {
- return BrowserStore.getItem("draft_" + channel_id + "_" + user_id);
+ getDraft: function(channel_id) {
+ return BrowserStore.getItem("draft_" + channel_id);
+ },
+ storeCommentDraft: function(parent_post_id, draft) {
+ BrowserStore.setItem("comment_draft_" + parent_post_id, draft);
+ },
+ getCommentDraft: function(parent_post_id) {
+ return BrowserStore.getItem("comment_draft_" + parent_post_id);
},
clearDraftUploads: function() {
BrowserStore.actionOnItemsWithPrefix("draft_", function (key, value) {
@@ -170,6 +174,14 @@ var PostStore = assign({}, EventEmitter.prototype, {
BrowserStore.setItem(key, value);
}
});
+ },
+ clearCommentDraftUploads: function() {
+ BrowserStore.actionOnItemsWithPrefix("comment_draft_", function (key, value) {
+ if (value) {
+ value.uploadsInProgress = 0;
+ BrowserStore.setItem(key, value);
+ }
+ });
}
});