summaryrefslogtreecommitdiffstats
path: root/store/sql_channel_store.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-04-03 13:32:58 -0400
committerCorey Hulen <corey@hulen.com>2017-04-03 10:32:58 -0700
commit6b61834ab14e9a4e51c29dd2904a1332c327aae6 (patch)
tree283122751e3e8c13cc058c4c575fd0e6d7a7549e /store/sql_channel_store.go
parente49f5928c55ba57c39efa11c568c66342b962aae (diff)
downloadchat-6b61834ab14e9a4e51c29dd2904a1332c327aae6.tar.gz
chat-6b61834ab14e9a4e51c29dd2904a1332c327aae6.tar.bz2
chat-6b61834ab14e9a4e51c29dd2904a1332c327aae6.zip
Add store unit tests and add make target for testing store with postgres (#5925)
* Add store unit tests and add make target for testing store with postgres * Remove postgres target form test-server target * Fix audit test
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r--store/sql_channel_store.go52
1 files changed, 0 insertions, 52 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index 309337e50..30f2cf7db 100644
--- a/store/sql_channel_store.go
+++ b/store/sql_channel_store.go
@@ -1257,58 +1257,6 @@ func (s SqlChannelStore) PermanentDeleteMembersByUser(userId string) StoreChanne
return storeChannel
}
-func (s SqlChannelStore) SetLastViewedAt(channelId string, userId string, newLastViewedAt int64) StoreChannel {
- storeChannel := make(StoreChannel, 1)
-
- go func() {
- result := StoreResult{}
-
- var query string
-
- if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
- query = `UPDATE
- ChannelMembers
- SET
- MentionCount = 0,
- MsgCount = Channels.TotalMsgCount - (SELECT COUNT(*)
- FROM Posts
- WHERE ChannelId = :ChannelId
- AND CreateAt > :NewLastViewedAt),
- LastViewedAt = :NewLastViewedAt
- FROM
- Channels
- WHERE
- Channels.Id = ChannelMembers.ChannelId
- AND UserId = :UserId
- AND ChannelId = :ChannelId`
- } else if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_MYSQL {
- query = `UPDATE
- ChannelMembers, Channels
- SET
- ChannelMembers.MentionCount = 0,
- ChannelMembers.MsgCount = Channels.TotalMsgCount - (SELECT COUNT(*)
- FROM Posts
- WHERE ChannelId = :ChannelId
- AND CreateAt > :NewLastViewedAt),
- ChannelMembers.LastViewedAt = :NewLastViewedAt
- WHERE
- Channels.Id = ChannelMembers.ChannelId
- AND UserId = :UserId
- AND ChannelId = :ChannelId`
- }
-
- _, err := s.GetMaster().Exec(query, map[string]interface{}{"ChannelId": channelId, "UserId": userId, "NewLastViewedAt": newLastViewedAt})
- if err != nil {
- result.Err = model.NewLocAppError("SqlChannelStore.SetLastViewedAt", "store.sql_channel.set_last_viewed_at.app_error", nil, "channel_id="+channelId+", user_id="+userId+", "+err.Error())
- }
-
- storeChannel <- result
- close(storeChannel)
- }()
-
- return storeChannel
-}
-
func (s SqlChannelStore) UpdateLastViewedAt(channelIds []string, userId string) StoreChannel {
storeChannel := make(StoreChannel, 1)