summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index f557fb05c..13e7b891d 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -73,7 +73,13 @@ func (s SqlPostStore) Save(post *model.Post) StoreChannel {
result.Err = model.NewAppError("SqlPostStore.Save", "We couldn't save the Post", "id="+post.Id+", "+err.Error())
} else {
time := model.GetMillis()
- s.GetMaster().Exec("UPDATE Channels SET LastPostAt = ?, TotalMsgCount = TotalMsgCount + 1 WHERE Id = ?", time, post.ChannelId)
+
+ if post.Type != model.POST_JOIN_LEAVE {
+ s.GetMaster().Exec("UPDATE Channels SET LastPostAt = ?, TotalMsgCount = TotalMsgCount + 1 WHERE Id = ?", time, post.ChannelId)
+ } else {
+ // don't update TotalMsgCount for unimportant messages so that the channel isn't marked as unread
+ s.GetMaster().Exec("UPDATE Channels SET LastPostAt = ? WHERE Id = ?", time, post.ChannelId)
+ }
if len(post.RootId) > 0 {
s.GetMaster().Exec("UPDATE Posts SET UpdateAt = ? WHERE Id = ?", time, post.RootId)