PLT-2687 sending email on upgrade and moving profile pic to new location (#2808)
* Fixing CLI and adding unit tests * Adding the upgrade_db_30 to the help text * Adding the upgrade_db_30 to the help text * Adding the upgrade_db_30 to the help text * Fixing CLI tests * PLT-2687 sending email on upgrade and moving profile pic to new location * Fixing img move * Fixing moving of profile image * making upgrade email localizable * Fixing email template
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
b49dc28d7e
Коммит
9fecf96d3b
@@ -553,7 +553,7 @@ func WriteFile(f []byte, path string) *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func moveFile(oldPath, newPath string) *model.AppError {
|
||||
func MoveFile(oldPath, newPath string) *model.AppError {
|
||||
if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 {
|
||||
fileData := make(chan []byte)
|
||||
getFileAndForget(oldPath, fileData)
|
||||
@@ -578,6 +578,11 @@ func moveFile(oldPath, newPath string) *model.AppError {
|
||||
return err
|
||||
}
|
||||
} else if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_LOCAL {
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(utils.Cfg.FileSettings.Directory+newPath), 0774); err != nil {
|
||||
return model.NewLocAppError("moveFile", "api.file.move_file.rename.app_error", nil, err.Error())
|
||||
}
|
||||
|
||||
if err := os.Rename(utils.Cfg.FileSettings.Directory+oldPath, utils.Cfg.FileSettings.Directory+newPath); err != nil {
|
||||
return model.NewLocAppError("moveFile", "api.file.move_file.rename.app_error", nil, err.Error())
|
||||
}
|
||||
|
||||
@@ -1211,7 +1211,7 @@ func DeletePostFilesAndForget(teamId string, post *model.Post) {
|
||||
splitUrl := strings.Split(filename, "/")
|
||||
oldPath := prefix + splitUrl[len(splitUrl)-2] + "/" + splitUrl[len(splitUrl)-1]
|
||||
newPath := prefix + splitUrl[len(splitUrl)-2] + "/deleted_" + splitUrl[len(splitUrl)-1]
|
||||
moveFile(oldPath, newPath)
|
||||
MoveFile(oldPath, newPath)
|
||||
}
|
||||
|
||||
}()
|
||||
|
||||
Ссылка в новой задаче
Block a user