summaryrefslogtreecommitdiffstats
path: root/store/sqlstore
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-10-02 08:04:38 +0200
committerGitHub <noreply@github.com>2018-10-02 08:04:38 +0200
commitc82a84ed765bd9c4d601b93201d93af92f6ee742 (patch)
tree468b65659656bea32721cda7a193dcc83f93a678 /store/sqlstore
parent3e462713debd5c992aa071bed902110bed88ec67 (diff)
downloadchat-c82a84ed765bd9c4d601b93201d93af92f6ee742.tar.gz
chat-c82a84ed765bd9c4d601b93201d93af92f6ee742.tar.bz2
chat-c82a84ed765bd9c4d601b93201d93af92f6ee742.zip
MM-12067: Add SetDefaultProfileImage to reset the user profile image to a generated one (#9449)
* MM-12067: Add SetDefaultProfileImage to reset the user profile image to a generated one * Allow to get the default profile image for my user * Allowing to reset the last update image date to 0 * PR reviews
Diffstat (limited to 'store/sqlstore')
-rw-r--r--store/sqlstore/user_store.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/store/sqlstore/user_store.go b/store/sqlstore/user_store.go
index 941aa60e9..1b9752064 100644
--- a/store/sqlstore/user_store.go
+++ b/store/sqlstore/user_store.go
@@ -212,6 +212,16 @@ func (us SqlUserStore) UpdateLastPictureUpdate(userId string) store.StoreChannel
})
}
+func (us SqlUserStore) ResetLastPictureUpdate(userId string) store.StoreChannel {
+ return store.Do(func(result *store.StoreResult) {
+ if _, err := us.GetMaster().Exec("UPDATE Users SET LastPictureUpdate = :Time, UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": 0, "UserId": userId}); err != nil {
+ result.Err = model.NewAppError("SqlUserStore.UpdateUpdateAt", "store.sql_user.update_last_picture_update.app_error", nil, "user_id="+userId, http.StatusInternalServerError)
+ } else {
+ result.Data = userId
+ }
+ })
+}
+
func (us SqlUserStore) UpdateUpdateAt(userId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
curTime := model.GetMillis()