summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-07-17 09:44:51 -0400
committerChristopher Speller <crspeller@gmail.com>2015-07-17 09:44:51 -0400
commitf49fccdee356d604a58ad0cddcc2fe5b7ebf5cc8 (patch)
treec4cd7d4be00788e68a7f7950945cf67fef7d2213 /store/sql_user_store.go
parent3f328546f8af55f655290aefad245b0f3b049bcd (diff)
parent1fe86a004ef2a99c55a583b2b2b0bf1c40b6afe3 (diff)
downloadchat-f49fccdee356d604a58ad0cddcc2fe5b7ebf5cc8.tar.gz
chat-f49fccdee356d604a58ad0cddcc2fe5b7ebf5cc8.tar.bz2
chat-f49fccdee356d604a58ad0cddcc2fe5b7ebf5cc8.zip
Merge pull request #196 from nickago/MM-1058
MM-1058 Added last updated for pictures
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r--store/sql_user_store.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index 77470946c..665e4d697 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -37,6 +37,7 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
}
func (s SqlUserStore) UpgradeSchemaIfNeeded() {
+ s.CreateColumnIfNotExists("Users","LastPictureUpdate", "LastPasswordUpdate", "bigint(20)", "0")
}
func (us SqlUserStore) CreateIndexesIfNotExists() {
@@ -120,6 +121,7 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha
user.AuthData = oldUser.AuthData
user.Password = oldUser.Password
user.LastPasswordUpdate = oldUser.LastPasswordUpdate
+ user.LastPictureUpdate = oldUser.LastPictureUpdate
user.TeamId = oldUser.TeamId
user.LastActivityAt = oldUser.LastActivityAt
user.LastPingAt = oldUser.LastPingAt
@@ -150,13 +152,15 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha
return storeChannel
}
-func (us SqlUserStore) UpdateUpdateAt(userId string) StoreChannel {
+func (us SqlUserStore) UpdateLastPictureUpdate(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
result := StoreResult{}
- if _, err := us.GetMaster().Exec("UPDATE Users SET UpdateAt = ? WHERE Id = ?", model.GetMillis(), userId); err != nil {
+ curTime := model.GetMillis()
+
+ if _, err := us.GetMaster().Exec("UPDATE Users SET LastPictureUpdate = ?, UpdateAt = ? WHERE Id = ?", curTime, curTime, userId); err != nil {
result.Err = model.NewAppError("SqlUserStore.UpdateUpdateAt", "We couldn't update the update_at", "user_id="+userId)
} else {
result.Data = userId