From cc40ca1ac01063441c35f8e5b57f813561a0b739 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Wed, 19 Aug 2015 09:52:03 -0400
Subject: Added a message deleted indicator when a post is deleted to let the
 user know what's happening.

---
 web/react/stores/post_store.jsx | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

(limited to 'web/react/stores/post_store.jsx')

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();
-- 
cgit v1.2.3-1-g7c22

