summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-05-12 18:36:30 -0700
committerCorey Hulen <corey@hulen.com>2016-05-12 18:36:30 -0700
commit9d94869cc6a0fb9f051879437c104ccd76094380 (patch)
tree4a61582c2a41b9d5983f107b0d66ece906d22718 /store/sql_user_store.go
parente46c1b8d52dce75a442b42c40803a071532676d7 (diff)
downloadchat-9d94869cc6a0fb9f051879437c104ccd76094380.tar.gz
chat-9d94869cc6a0fb9f051879437c104ccd76094380.tar.bz2
chat-9d94869cc6a0fb9f051879437c104ccd76094380.zip
Fixing issue with missing user (#2989)
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r--store/sql_user_store.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index 080d8d128..a6b706380 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -197,6 +197,27 @@ func (us SqlUserStore) UpdateLastPictureUpdate(userId string) StoreChannel {
return storeChannel
}
+func (us SqlUserStore) UpdateUpdateAt(userId string) StoreChannel {
+ storeChannel := make(StoreChannel)
+
+ go func() {
+ result := StoreResult{}
+
+ curTime := model.GetMillis()
+
+ if _, err := us.GetMaster().Exec("UPDATE Users SET UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": curTime, "UserId": userId}); err != nil {
+ result.Err = model.NewLocAppError("SqlUserStore.UpdateUpdateAt", "store.sql_user.update_update.app_error", nil, "user_id="+userId)
+ } else {
+ result.Data = userId
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
func (us SqlUserStore) UpdateLastPingAt(userId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
@@ -461,7 +482,7 @@ func (s SqlUserStore) GetEtagForDirectProfiles(userId string) StoreChannel {
WHERE
UserId = :UserId
AND Category = 'direct_channel_show')
- ORDER BY UpdateAt DESC
+ ORDER BY UpdateAt DESC LIMIT 1
`, map[string]interface{}{"UserId": userId})
if err != nil {
result.Data = fmt.Sprintf("%v.%v", model.CurrentVersion, model.GetMillis())