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
Этот коммит содержится в:
Jesús Espino
2018-10-02 08:04:38 +02:00
коммит произвёл GitHub
родитель 3e462713de
Коммит c82a84ed76
8 изменённых файлов: 248 добавлений и 34 удалений

Просмотреть файл

@@ -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()