summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.go
diff options
context:
space:
mode:
authorAsaad Mahmood <Unknowngi@live.com>2015-07-07 22:57:57 +0500
committerAsaad Mahmood <Unknowngi@live.com>2015-07-07 22:57:57 +0500
commit69e5898f4b48660a8eb5736eb23f9f63d464a90f (patch)
tree07cace5f0f5eca1858222b3aab96add2e865b8ca /store/sql_post_store.go
parent14f02b770b5b5ea65003ae6e885d52d619a3f836 (diff)
parent4e856c29b20270997ef54bdcc4260ff28390873f (diff)
downloadchat-69e5898f4b48660a8eb5736eb23f9f63d464a90f.tar.gz
chat-69e5898f4b48660a8eb5736eb23f9f63d464a90f.tar.bz2
chat-69e5898f4b48660a8eb5736eb23f9f63d464a90f.zip
Merge branch 'master' of https://github.com/mattermost/platform
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index 01900023f..7ada515d7 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -72,7 +72,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)
@@ -361,8 +367,8 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht
searchType := "Message"
if isHashtagSearch {
searchType = "Hashtags"
- for _,term := range strings.Split(terms, " ") {
- termMap[term] = true;
+ for _, term := range strings.Split(terms, " ") {
+ termMap[term] = true
}
}