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.jsx33
1 files changed, 20 insertions, 13 deletions
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx
index 8609d8bbf..4a9314b31 100644
--- a/web/react/stores/post_store.jsx
+++ b/web/react/stores/post_store.jsx
@@ -230,7 +230,7 @@ class PostStoreClass extends EventEmitter {
getPosts(channelId) {
return BrowserStore.getItem('posts_' + channelId);
}
- getCurrentUsersLatestPost(channelId) {
+ getCurrentUsersLatestPost(channelId, rootId) {
const userId = UserStore.getCurrentId();
var postList = makePostListNonNull(this.getPosts(channelId));
var i = 0;
@@ -239,8 +239,15 @@ class PostStoreClass extends EventEmitter {
for (i; i < len; i++) {
if (postList.posts[postList.order[i]].user_id === userId) {
- lastPost = postList.posts[postList.order[i]];
- break;
+ if (rootId) {
+ if (postList.posts[postList.order[i]].root_id === rootId || postList.posts[postList.order[i]].id === rootId) {
+ lastPost = postList.posts[postList.order[i]];
+ break;
+ }
+ } else {
+ lastPost = postList.posts[postList.order[i]];
+ break;
+ }
}
}
@@ -317,10 +324,10 @@ class PostStoreClass extends EventEmitter {
return 0;
});
- BrowserStore.setItem('pending_posts_' + channelId, postList);
+ BrowserStore.setGlobalItem('pending_posts_' + channelId, postList);
}
getPendingPosts(channelId) {
- return BrowserStore.getItem('pending_posts_' + channelId);
+ return BrowserStore.getGlobalItem('pending_posts_' + channelId);
}
storeUnseenDeletedPost(post) {
var posts = this.getUnseenDeletedPosts(post.channel_id);
@@ -364,7 +371,7 @@ class PostStoreClass extends EventEmitter {
this.pStorePendingPosts(channelId, postList);
}
clearPendingPosts() {
- BrowserStore.actionOnItemsWithPrefix('pending_posts_', function clearPending(key) {
+ BrowserStore.actionOnGlobalItemsWithPrefix('pending_posts_', function clearPending(key) {
BrowserStore.removeItem(key);
});
}
@@ -407,26 +414,26 @@ class PostStoreClass extends EventEmitter {
}
storeCurrentDraft(draft) {
var channelId = ChannelStore.getCurrentId();
- BrowserStore.setItem('draft_' + channelId, draft);
+ BrowserStore.setGlobalItem('draft_' + channelId, draft);
}
getCurrentDraft() {
var channelId = ChannelStore.getCurrentId();
return this.getDraft(channelId);
}
storeDraft(channelId, draft) {
- BrowserStore.setItem('draft_' + channelId, draft);
+ BrowserStore.setGlobalItem('draft_' + channelId, draft);
}
getDraft(channelId) {
- return BrowserStore.getItem('draft_' + channelId, this.getEmptyDraft());
+ return BrowserStore.getGlobalItem('draft_' + channelId, this.getEmptyDraft());
}
storeCommentDraft(parentPostId, draft) {
- BrowserStore.setItem('comment_draft_' + parentPostId, draft);
+ BrowserStore.setGlobalItem('comment_draft_' + parentPostId, draft);
}
getCommentDraft(parentPostId) {
- return BrowserStore.getItem('comment_draft_' + parentPostId, this.getEmptyDraft());
+ return BrowserStore.getGlobalItem('comment_draft_' + parentPostId, this.getEmptyDraft());
}
clearDraftUploads() {
- BrowserStore.actionOnItemsWithPrefix('draft_', function clearUploads(key, value) {
+ BrowserStore.actionOnGlobalItemsWithPrefix('draft_', function clearUploads(key, value) {
if (value) {
value.uploadsInProgress = [];
BrowserStore.setItem(key, value);
@@ -434,7 +441,7 @@ class PostStoreClass extends EventEmitter {
});
}
clearCommentDraftUploads() {
- BrowserStore.actionOnItemsWithPrefix('comment_draft_', function clearUploads(key, value) {
+ BrowserStore.actionOnGlobalItemsWithPrefix('comment_draft_', function clearUploads(key, value) {
if (value) {
value.uploadsInProgress = [];
BrowserStore.setItem(key, value);