chore_: remove deprecated `CreateAccount.BackupDisabledDataDir` (#5664)
* chore_: remove deprecated CreateAccount.BackupDisabledDataDir * test_: cover ErrCreateAccountInvalidRootDataDir
This commit is contained in:
parent
2f5437130e
commit
eeb34f780f
|
@ -1741,7 +1741,7 @@ func TestRestoreAccountAndLogin(t *testing.T) {
|
|||
DeviceName: "StatusIM",
|
||||
Password: "password",
|
||||
CustomizationColor: "0x000000",
|
||||
BackupDisabledDataDir: tmpdir,
|
||||
RootDataDir: tmpdir,
|
||||
},
|
||||
}
|
||||
account, err := backend.RestoreAccountAndLogin(restoreRequest)
|
||||
|
@ -1778,10 +1778,8 @@ func TestCreateAccountPathsValidation(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
request.RootDataDir = ""
|
||||
request.BackupDisabledDataDir = tmpdir
|
||||
err = request.Validate(validation)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tmpdir, request.RootDataDir)
|
||||
require.ErrorIs(t, err, requests.ErrCreateAccountInvalidRootDataDir)
|
||||
}
|
||||
|
||||
func TestRestoreKeycardAccountAndLogin(t *testing.T) {
|
||||
|
|
|
@ -208,7 +208,7 @@ func main() {
|
|||
DeviceName: "StatusIM",
|
||||
Password: *password,
|
||||
CustomizationColor: "0x000000",
|
||||
BackupDisabledDataDir: config.DataDir,
|
||||
RootDataDir: config.DataDir,
|
||||
APIConfig: &requests.APIConfig{
|
||||
ConnectorEnabled: config.ClusterConfig.Enabled,
|
||||
HTTPEnabled: config.HTTPEnabled,
|
||||
|
|
|
@ -33,10 +33,6 @@ type APIConfig struct {
|
|||
}
|
||||
|
||||
type CreateAccount struct {
|
||||
// Deprecated: BackupDisabledDataDir is the directory where backup is disabled
|
||||
// Use `RootDataDir` instead. Effective BackupDisabledDataDir value will default to RootDataDir + "./".
|
||||
BackupDisabledDataDir string `json:"backupDisabledDataDir"`
|
||||
|
||||
// RootDataDir is an absolute path to the root directory where all data will be stored.
|
||||
RootDataDir string `json:"rootDataDir"`
|
||||
KdfIterations int `json:"kdfIterations"`
|
||||
|
@ -134,14 +130,8 @@ func (c *CreateAccount) Validate(validation *CreateAccountValidation) error {
|
|||
}
|
||||
|
||||
if len(c.RootDataDir) == 0 {
|
||||
if c.BackupDisabledDataDir == "" {
|
||||
return ErrCreateAccountInvalidRootDataDir
|
||||
}
|
||||
// NOTE: Fallback to old BackupDisabledDataDir field.
|
||||
// Remove this when both desktop and mobile use the new `RootDataDir` field.
|
||||
// Return error if `RootDataDir` is empty.
|
||||
c.RootDataDir = c.BackupDisabledDataDir
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue