[MM-43444] Delete profile image and invalidate cache on permanent user deletion (#20033)
* Delete profile image and invalidate cache on permanent user deletion * Modify request to send 202 with error information on failing to delete profile image
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6adbcc5d05
Коммит
e3efc46f69
@@ -9,6 +9,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -1036,6 +1037,12 @@ func TestPermanentDeleteUser(t *testing.T) {
|
||||
|
||||
require.Nil(t, err, "Unable to upload file. err=%v", err)
|
||||
|
||||
// upload profile image
|
||||
user := th.BasicUser
|
||||
|
||||
err = th.App.SetDefaultProfileImage(th.Context, user)
|
||||
require.Nil(t, err)
|
||||
|
||||
bot, err := th.App.CreateBot(th.Context, &model.Bot{
|
||||
Username: "botname",
|
||||
Description: "a bot",
|
||||
@@ -1076,6 +1083,11 @@ func TestPermanentDeleteUser(t *testing.T) {
|
||||
require.Nil(t, finfo, "Unable to find finfo. err=%v", err)
|
||||
|
||||
require.NotNil(t, err, "GetFileInfo after DeleteUser is nil. err=%v", err)
|
||||
|
||||
// test deletion of profile picture
|
||||
exists, err := th.App.FileExists(filepath.Join("users", user.Id))
|
||||
require.Nil(t, err, "Unable to stat finfo. err=%v", err)
|
||||
require.False(t, exists, "Profile image wasn't deleted. err=%v", err)
|
||||
}
|
||||
|
||||
func TestPasswordRecovery(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user