Skip to content

Commit

Permalink
error message when sharing dataset with user (#1140)
Browse files Browse the repository at this point in the history
* message works for share dataset with user
strange bug - sharing with group shows 2 entries?

* removing old method
  • Loading branch information
tcnichol authored Aug 30, 2024
1 parent c6e1267 commit a28c5fb
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions frontend/src/components/datasets/ShareDatasetModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,34 +85,11 @@ export default function ShareDatasetModal(props: ShareDatasetModalProps) {
}, [users, myProfile.email]);

const onShare = async () => {
setShowFailAlert(false);
setShowSuccessAlert(false);
await setUserRole(datasetId, email, role);
// setGroup({ label: "", id: "" });
setRole("viewer");
setShowSuccessAlert(true);
getRoles(datasetId);
const currentRoles = datasetRoles;
// TODO check for roles
let found_user = false;
if (currentRoles !== undefined && currentRoles.user_roles !== undefined) {
currentRoles.user_roles.map((currentRole) => {
if (currentRole.user.email === email) {
if (currentRole.role.toString() === role.toString()) {
found_user = true;
}
}
});
}
if (found_user) {
setEmail("");
setRole("viewer");
setShowFailAlert(false);
setShowSuccessAlert(true);
getRoles(datasetId);
} else {
setEmail("");
setRole("viewer");
setShowFailAlert(true);
getRoles(datasetId);
}
};

return (
Expand Down

0 comments on commit a28c5fb

Please sign in to comment.