diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-04-03 13:32:58 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-04-03 10:32:58 -0700 |
commit | 6b61834ab14e9a4e51c29dd2904a1332c327aae6 (patch) | |
tree | 283122751e3e8c13cc058c4c575fd0e6d7a7549e /store/sql_user_store.go | |
parent | e49f5928c55ba57c39efa11c568c66342b962aae (diff) | |
download | chat-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_user_store.go')
-rw-r--r-- | store/sql_user_store.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index bcbd850c8..1a8ff5c90 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -4,7 +4,6 @@ package store import ( - "crypto/md5" "database/sql" "fmt" "net/http" @@ -426,58 +425,6 @@ func (us SqlUserStore) GetAll() StoreChannel { return storeChannel } -func (s SqlUserStore) GetEtagForDirectProfiles(userId string) StoreChannel { - storeChannel := make(StoreChannel, 1) - - go func() { - result := StoreResult{} - - var ids []string - _, err := s.GetReplica().Select(ids, ` - SELECT - Id - FROM - Users - WHERE - Id IN (SELECT DISTINCT - UserId - FROM - ChannelMembers - WHERE - ChannelMembers.UserId != :UserId - AND ChannelMembers.ChannelId IN (SELECT - Channels.Id - FROM - Channels, - ChannelMembers - WHERE - Channels.Type = 'D' - AND Channels.Id = ChannelMembers.ChannelId - AND ChannelMembers.UserId = :UserId)) - OR Id IN (SELECT - Name - FROM - Preferences - WHERE - UserId = :UserId - AND Category = 'direct_channel_show') - ORDER BY UpdateAt DESC - `, map[string]interface{}{"UserId": userId}) - - if err != nil || len(ids) == 0 { - result.Data = fmt.Sprintf("%v.%v.0.%v.%v", model.CurrentVersion, model.GetMillis(), utils.Cfg.PrivacySettings.ShowFullName, utils.Cfg.PrivacySettings.ShowEmailAddress) - } else { - allIds := strings.Join(ids, "") - result.Data = fmt.Sprintf("%v.%x.%v.%v.%v", model.CurrentVersion, md5.Sum([]byte(allIds)), len(ids), utils.Cfg.PrivacySettings.ShowFullName, utils.Cfg.PrivacySettings.ShowEmailAddress) - } - - storeChannel <- result - close(storeChannel) - }() - - return storeChannel -} - func (s SqlUserStore) GetEtagForAllProfiles() StoreChannel { storeChannel := make(StoreChannel, 1) |