Conversation
…efactor related tests; add findBackupFolderByName functionality with tests
src/apps/main/auth/service.ts
Outdated
| function saveConfig() { | ||
| const user = getUser(); | ||
| if (!user) { | ||
| return; | ||
| } | ||
|
|
||
| const { uuid } = user; |
There was a problem hiding this comment.
You could just pass the user's uuid and make the caller do the getUser, the way it is now it could be misleading with the early return.
src/apps/main/auth/service.ts
Outdated
| } | ||
|
|
||
| try { | ||
| if (!safeStorage.isEncryptionAvailable()) { |
There was a problem hiding this comment.
When this would happen actually? that the safeStorage is not available
|
|
||
| export async function findBackupFolderByName({ deviceUuid, folderName }: Props) { | ||
| const { data: folder, error } = await fetchFolder(deviceUuid); | ||
| if (error) return; |
There was a problem hiding this comment.
Why not just pass arround the error? This is could be misleading
There was a problem hiding this comment.
No need to return anything here. If the operation fails, the normal error flow of the backup folder creation function handles it automatically. The function either returns a folder on success or nothing on failure, which is sufficient.
| if (error) return; | ||
|
|
||
| const existingFolder = folder.children.find((child) => child.plainName === folderName); | ||
| if (!existingFolder) return; |
There was a problem hiding this comment.
No need to return anything here. If the operation fails, the normal error flow of the backup folder creation function handles it automatically. The function either returns a folder on success or nothing on failure, which is sufficient.
src/apps/main/backups/post-backup.ts
Outdated
| @@ -10,21 +11,38 @@ type Props = { | |||
|
|
|||
| export async function postBackup({ folderName, device }: Props) { | |||
There was a problem hiding this comment.
Then, this method name should change since the method name does not really reflect the behaviour, since is creating or retrieving the already existing one
…efactor related tests; add findBackupFolderByName functionality with tests
|



What is Changed / Added
In a subsequent PR, a function necessary to recover the backup list was removed. It has been added back, and the option to re-add folders when they already exist remotely but were lost in the local list has also been added.
Why