summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-01-27 15:58:50 -0500
committerGitHub <noreply@github.com>2017-01-27 15:58:50 -0500
commit65b76c2712eea4daa1633e4652fa3cd51037e854 (patch)
tree66306b5bd44ae7a4df4a7121fe85b9887cff160e /store
parent097289f8e473c799ee752aa56e08f605110f5217 (diff)
downloadchat-65b76c2712eea4daa1633e4652fa3cd51037e854.tar.gz
chat-65b76c2712eea4daa1633e4652fa3cd51037e854.tar.bz2
chat-65b76c2712eea4daa1633e4652fa3cd51037e854.zip
PLT-5225 Added separate post types for certain system messages (#5193)
* Added separate post types for system_join_leave and system_add_remove posts * Added username prop to channel deleted posts * Changed slack import to properly generate the new join/leave messages * Added username prop to channel update posts * Moved Post(AddTo/RemoveFrom)ChanneMessage into app package
Diffstat (limited to 'store')
-rw-r--r--store/sql_post_store.go3
-rw-r--r--store/sql_post_store_test.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index ed87b01f7..a8fe52380 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -93,7 +93,8 @@ func (s SqlPostStore) Save(post *model.Post) StoreChannel {
} else {
time := post.UpdateAt
- if post.Type != model.POST_JOIN_LEAVE && post.Type != model.POST_ADD_REMOVE {
+ if post.Type != model.POST_JOIN_LEAVE && post.Type != model.POST_JOIN_CHANNEL && post.Type != model.POST_LEAVE_CHANNEL &&
+ post.Type != model.POST_ADD_REMOVE && post.Type != model.POST_ADD_TO_CHANNEL && post.Type != model.POST_REMOVE_FROM_CHANNEL {
s.GetMaster().Exec("UPDATE Channels SET LastPostAt = :LastPostAt, TotalMsgCount = TotalMsgCount + 1 WHERE Id = :ChannelId", map[string]interface{}{"LastPostAt": time, "ChannelId": post.ChannelId})
} else {
// don't update TotalMsgCount for unimportant messages so that the channel isn't marked as unread
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index e3886c6bc..7416e0ab7 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -799,7 +799,7 @@ func TestPostStoreSearch(t *testing.T) {
o1a.ChannelId = c1.Id
o1a.UserId = model.NewId()
o1a.Message = "corey mattermost new york"
- o1a.Type = model.POST_JOIN_LEAVE
+ o1a.Type = model.POST_JOIN_CHANNEL
o1a = (<-store.Post().Save(o1a)).Data.(*model.Post)
o2 := &model.Post{}