New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove secret from folder #3
Conversation
'createSecretUserRightsSuccess', | ||
'createSecretUserRightsFailure', | ||
'updateSecretUserRightsSuccess', | ||
'updateSecretUserRightsFailure', | ||
'deleteSecretUserRightsSuccess', | ||
'deleteSecretUserRightsFailure', | ||
'removeSecretFromCurrentFolderSuccess', | ||
'removeSecretFromCurrentFolderFailure', | ||
'moveSecretToFolderSuccess', | ||
'moveSecretToFolderFailure', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please cleanup unused/commented code. Even if we plan to re-use it later, git is here to retrieve it if we need :)
@@ -43,6 +48,9 @@ class MetadataActions { | |||
return secretin | |||
.deleteSecret(secret.id) | |||
.catch((error) => { | |||
this.deleteSecretFailure({ | |||
currentUser: secretin.currentUser, | |||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I now know we can easily have metadata, please return only those. Current user is useless here :)
ℹ️ Also for the success action.
// this.moveSecretToFolderFailure({ error }); | ||
// throw error; | ||
// }); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this :)
secret, | ||
currentFolderId: parentFolderId, | ||
})} | ||
disabled={!secret.canBeUpdatedBy(currentUser) || typeof parentFolderId === 'undefined'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parentFolderId
may be null
, undefined
, or a string. Probably useless to check the type here?
@@ -38,6 +38,12 @@ class MetadataStore { | |||
); | |||
} | |||
|
|||
onDeleteSecretFailure({ currentUser }) { | |||
this.setState(this.state | |||
.set('metadata', Immutable.fromJS(currentUser.metadatas).map(secret => Secret.createFromRaw(secret))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you'll change the return value, you won't need currentUser
here ;)
Replace
moveSecretToFolder
byaddSecretToFolder
because move means deletion from the previous folder and would be a different action (done later).New actions
removeFromCurrentFolder
was written to put back one secret/folder in ROOT directory and unshare it with everybody accessing the folder.