Commit cecc375c authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: always use version id when getting item info contributors

parent 73d36649
Pipeline #215074 passed with stages
in 8 minutes and 58 seconds
...@@ -7,12 +7,11 @@ import { Fragment, useState } from 'react' ...@@ -7,12 +7,11 @@ import { Fragment, useState } from 'react'
import type { ActorDto, PropertyDto } from '@/api/sshoc' import type { ActorDto, PropertyDto } from '@/api/sshoc'
import { import {
useGetInformationContributors,
useGetInformationContributors1,
useGetInformationContributors2,
useGetInformationContributors3,
useGetInformationContributors4,
useGetInformationContributors5, useGetInformationContributors5,
useGetInformationContributorsForVersion,
useGetInformationContributorsForVersion1,
useGetInformationContributorsForVersion2,
useGetInformationContributorsForVersion3,
useGetItemCategories, useGetItemCategories,
} from '@/api/sshoc' } from '@/api/sshoc'
import { getMediaFileUrl, getMediaThumbnailUrl } from '@/api/sshoc/client' import { getMediaFileUrl, getMediaThumbnailUrl } from '@/api/sshoc/client'
...@@ -159,6 +158,7 @@ export default function ItemLayout({ ...@@ -159,6 +158,7 @@ export default function ItemLayout({
<ItemContributors <ItemContributors
id={item.persistentId} id={item.persistentId}
category={item.category as Exclude<ItemCategory, 'step'>} category={item.category as Exclude<ItemCategory, 'step'>}
versionId={item.id}
/> />
</VStack> </VStack>
</SideColumn> </SideColumn>
...@@ -719,25 +719,27 @@ function useItemMetadata({ ...@@ -719,25 +719,27 @@ function useItemMetadata({
function ItemContributors({ function ItemContributors({
id, id,
category, category,
versionId,
}: { }: {
id: string id: string
category: Exclude<ItemCategory, 'step'> category: Exclude<ItemCategory, 'step'>
versionId: number
}) { }) {
/** /**
* Unfortunately, the OpenApi doc does not have unique operation ids for * Unfortunately, the OpenApi doc does not have unique operation ids for
* `getInformationContributors`, so we end up with numbered suffixes. * `getInformationContributors`, so we end up with numbered suffixes.
*/ */
const op = { const op = {
dataset: useGetInformationContributors4, dataset: useGetInformationContributors5,
publication: useGetInformationContributors, publication: useGetInformationContributorsForVersion,
'tool-or-service': useGetInformationContributors2, 'tool-or-service': useGetInformationContributorsForVersion2,
'training-material': useGetInformationContributors3, 'training-material': useGetInformationContributorsForVersion3,
workflow: useGetInformationContributors1, workflow: useGetInformationContributorsForVersion1,
} }
const contributors = op[category]( const contributors = op[category](
// @ts-expect-error Yuck // @ts-expect-error Yuck
category === 'workflow' ? { workflowId: id } : { id }, category === 'workflow' ? { workflowId: id, versionId } : { id, versionId },
) )
if (!Array.isArray(contributors.data) || contributors.data.length === 0) { if (!Array.isArray(contributors.data) || contributors.data.length === 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment