Skip to content

Commit f2d2728

Browse files
committed
remove general perm check to check for orcid id in contributors array - needs hook up with #3510(or future update) and datacite.yml
1 parent ff8884a commit f2d2728

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

packages/openneuro-app/src/scripts/dataset/mutations/request-contributor-status.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99
} from "../../queries/datasetEvents.js"
1010

1111
export const RequestContributorButton = (
12-
{ datasetId, datasetPermissions, currentUserId },
12+
{ dataset, currentUserId },
1313
) => {
1414
const [createContributorRequest, { loading }] = useMutation(
1515
CREATE_CONTRIBUTOR_REQUEST_EVENT,
1616
{
17-
variables: { datasetId },
17+
variables: { datasetId: dataset.id },
1818
refetchQueries: [
19-
{ query: DATASET_EVENTS_QUERY, variables: { datasetId } },
19+
{ query: DATASET_EVENTS_QUERY, variables: { datasetId: dataset.id } },
2020
],
2121
onCompleted: () => {
2222
toast.success(
@@ -43,14 +43,15 @@ export const RequestContributorButton = (
4343
}
4444
}
4545

46-
// Determine if the current user already has any permissions (read, write, admin)
47-
// If they do, the button should not be displayed.
48-
const hasPermissions = datasetPermissions?.some((p) =>
49-
p.user.id === currentUserId &&
50-
(p.level === "admin" || p.level === "rw" || p.level === "read")
46+
// TODO
47+
// Check if the current user's ORCID is present in the
48+
// dataset.contributors array. TODO as contributors doesn't
49+
// exist on Datasets yet
50+
const isContributor = dataset?.contributors?.some((contributor) =>
51+
contributor.orcid === currentUserId
5152
)
5253

53-
if (hasPermissions) {
54+
if (isContributor) {
5455
return null
5556
}
5657

packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,7 @@ export const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
185185
<>
186186
{profile && (
187187
<RequestContributorButton
188-
datasetId={datasetId}
189-
datasetPermissions={dataset.permissions
190-
?.userPermissions ||
191-
[]}
188+
dataset={dataset}
192189
currentUserId={currentUserId}
193190
/>
194191
)}

0 commit comments

Comments
 (0)