[MM-44954] Regenerate default avatar (#22871)

* Regenerate default profile picture if username has changed

- Only actions is profile picture has not been changed
- Adjusts ResetLastPictureUpdate store function to store
-curTime instead of 0
    - This is to support updating the default picture while still
    retaining the ability to discern a default image from a set one.
- Changes SetDefaultProfileImage to leverage UpdateDefaultProfileImage
- Test updates around updating user default profile pictures

* App interface updates

* Only display picture update date if non-negative

- Ensures we don't display negative timestamps (default images)
- Change ported for mono-repo changes

* Remove duplicate test assertion

---------

Co-authored-by: Nathan Geist <ngeist@spiria.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Nathan
2023-05-04 08:14:26 -06:00
коммит произвёл GitHub
родитель 349e5d4573
Коммит 670b0e4c9f
8 изменённых файлов: 105 добавлений и 18 удалений

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

@@ -285,7 +285,7 @@ func (us SqlUserStore) UpdateLastPictureUpdate(userId string) error {
func (us SqlUserStore) ResetLastPictureUpdate(userId string) error {
curTime := model.GetMillis()
if _, err := us.GetMasterX().Exec("UPDATE Users SET LastPictureUpdate = ?, UpdateAt = ? WHERE Id = ?", 0, curTime, userId); err != nil {
if _, err := us.GetMasterX().Exec("UPDATE Users SET LastPictureUpdate = ?, UpdateAt = ? WHERE Id = ?", -curTime, curTime, userId); err != nil {
return errors.Wrapf(err, "failed to update User with userId=%s", userId)
}