diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-08-19 09:52:03 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-08-19 09:52:03 -0400 |
commit | cc40ca1ac01063441c35f8e5b57f813561a0b739 (patch) | |
tree | bb3b8ffab02d301cdb443f0cd65ef6627c4ecc37 /web/react/stores/post_store.jsx | |
parent | 104f4a5ad8ee8bdd31713c31f355303fc1536e46 (diff) | |
download | chat-cc40ca1ac01063441c35f8e5b57f813561a0b739.tar.gz chat-cc40ca1ac01063441c35f8e5b57f813561a0b739.tar.bz2 chat-cc40ca1ac01063441c35f8e5b57f813561a0b739.zip |
Added a message deleted indicator when a post is deleted to let the user know what's happening.
Diffstat (limited to 'web/react/stores/post_store.jsx')
-rw-r--r-- | web/react/stores/post_store.jsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 3e4fde30a..2fffb17d0 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -172,6 +172,28 @@ var PostStore = assign({}, EventEmitter.prototype, { getPendingPosts: function(channelId) { return BrowserStore.getItem('pending_posts_' + channelId); }, + storeUnseenDeletedPost: function(post) { + var posts = this.getUnseenDeletedPosts(post.channel_id); + + if (!posts) { + posts = {}; + } + + post.message = '(message deleted)'; + post.state = Constants.POST_DELETED; + + posts[post.id] = post; + this.storeUnseenDeletedPosts(post.channel_id, posts); + }, + storeUnseenDeletedPosts: function(channelId, posts) { + BrowserStore.setItem('deleted_posts_' + channelId, posts); + }, + getUnseenDeletedPosts: function(channelId) { + return BrowserStore.getItem('deleted_posts_' + channelId); + }, + clearUnseenDeletedPosts: function(channelId) { + BrowserStore.setItem('deleted_posts_' + channelId, {}); + }, removePendingPost: function(channelId, pendingPostId) { this._removePendingPost(channelId, pendingPostId); this.emitChange(); |