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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3e462713de
Коммит
c82a84ed76
@@ -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()
|
||||
|
||||
@@ -230,6 +230,7 @@ type UserStore interface {
|
||||
Save(user *model.User) StoreChannel
|
||||
Update(user *model.User, allowRoleUpdate bool) StoreChannel
|
||||
UpdateLastPictureUpdate(userId string) StoreChannel
|
||||
ResetLastPictureUpdate(userId string) StoreChannel
|
||||
UpdateUpdateAt(userId string) StoreChannel
|
||||
UpdatePassword(userId, newPassword string) StoreChannel
|
||||
UpdateAuthData(userId string, service string, authData *string, email string, resetMfa bool) StoreChannel
|
||||
|
||||
@@ -593,6 +593,22 @@ func (_m *UserStore) PermanentDelete(userId string) store.StoreChannel {
|
||||
return r0
|
||||
}
|
||||
|
||||
// ResetLastPictureUpdate provides a mock function with given fields: userId
|
||||
func (_m *UserStore) ResetLastPictureUpdate(userId string) store.StoreChannel {
|
||||
ret := _m.Called(userId)
|
||||
|
||||
var r0 store.StoreChannel
|
||||
if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok {
|
||||
r0 = rf(userId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(store.StoreChannel)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Save provides a mock function with given fields: user
|
||||
func (_m *UserStore) Save(user *model.User) store.StoreChannel {
|
||||
ret := _m.Called(user)
|
||||
|
||||
Ссылка в новой задаче
Block a user