summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-06-28 23:06:45 -0400
committerSaturnino Abril <saturnino.abril@gmail.com>2017-06-29 11:06:45 +0800
commit520cedea16c3a4c71c2d11ede89c6a50a81ff8db (patch)
treebe9ed4563b6a249d7f0ac4df632162b5d90b887f /store
parent9e600fcdccabfc55b85c026eda5eedab5bc91152 (diff)
downloadchat-520cedea16c3a4c71c2d11ede89c6a50a81ff8db.tar.gz
chat-520cedea16c3a4c71c2d11ede89c6a50a81ff8db.tar.bz2
chat-520cedea16c3a4c71c2d11ede89c6a50a81ff8db.zip
PLT-6909 Remove deleted emojis from cache (#6757)
* PLT-6909 Remove deleted emojis from cache * Fixed unit tests
Diffstat (limited to 'store')
-rw-r--r--store/sql_emoji_store.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/store/sql_emoji_store.go b/store/sql_emoji_store.go
index a51020bba..2a8ea080e 100644
--- a/store/sql_emoji_store.go
+++ b/store/sql_emoji_store.go
@@ -4,6 +4,8 @@
package store
import (
+ "net/http"
+
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
@@ -104,7 +106,7 @@ func (es SqlEmojiStore) Get(id string, allowFromCache bool) StoreChannel {
WHERE
Id = :Id
AND DeleteAt = 0`, map[string]interface{}{"Id": id}); err != nil {
- result.Err = model.NewLocAppError("SqlEmojiStore.Get", "store.sql_emoji.get.app_error", nil, "id="+id+", "+err.Error())
+ result.Err = model.NewAppError("SqlEmojiStore.Get", "store.sql_emoji.get.app_error", nil, "id="+id+", "+err.Error(), http.StatusNotFound)
} else {
result.Data = emoji
@@ -195,6 +197,8 @@ func (es SqlEmojiStore) Delete(id string, time int64) StoreChannel {
result.Err = model.NewLocAppError("SqlEmojiStore.Delete", "store.sql_emoji.delete.no_results", nil, "id="+id+", err="+err.Error())
}
+ emojiCache.Remove(id)
+
storeChannel <- result
close(storeChannel)
}()