Skip to content
Snippets Groups Projects
Commit 56ff28d7 authored by Sinzeanu Demetriad's avatar Sinzeanu Demetriad
Browse files

refactor(utils): Update isLatestVersion method

parent 40fa93df
No related branches found
No related tags found
3 merge requests!136Sprint 22 features (updates),!128feat(ManuscriptHeader): As user, I want to see the label "You're viewing a…,!127Hin 1082
......@@ -23,7 +23,7 @@ const ManuscriptHeader = ({
manuscriptType = {},
editorInChief = 'Unassigned',
collection: { visibleStatus = 'Draft', customId, handlingEditor },
latestVersion,
isLatestVersion,
}) => {
const { authors = [], metadata = {}, submitted = null } = fragment
const { title = 'No title', journal = '', type = '' } = metadata
......@@ -35,7 +35,7 @@ const ManuscriptHeader = ({
justify="space-between"
>
<H2 mb={1}>{title}</H2>
{latestVersion ? (
{isLatestVersion ? (
<Tag data-test-id="fragment-status" status>
{visibleStatus}
</Tag>
......
......@@ -67,7 +67,7 @@ const ManuscriptLayout = ({
recommendationHandler,
inviteHandlingEditor,
versions,
latestVersion,
isLatestVersion,
}) => (
<Root pb={30}>
{!isEmpty(collection) && !isEmpty(fragment) ? (
......@@ -88,8 +88,8 @@ const ManuscriptLayout = ({
handlingEditors={handlingEditors}
inviteHE={toggleAssignHE}
isFetching={isFetchingData.editorsFetching}
isLatestVersion={isLatestVersion}
journal={journal}
latestVersion={latestVersion}
resendInvitation={inviteHandlingEditor.assignHE}
revokeInvitation={inviteHandlingEditor.revokeHE}
versions={versions}
......
......@@ -288,7 +288,7 @@ export default compose(
shouldReview:
get(currentUser, 'isReviewer', false) &&
isUndefined(submittedOwnRecommendation),
latestVersion: isLatestVersion(collection, fragment),
isLatestVersion: isLatestVersion(collection, fragment),
}),
),
withInviteHandlingEditor,
......
......@@ -76,7 +76,7 @@ export const parseVersion = version => ({
})
export const isLatestVersion = (collection, fragment) =>
get(fragment, 'id') === last(collection.fragments)
get(fragment, 'id', '') === last(get(collection, 'fragments', []))
export const parseJournalIssue = (journal, metadata) =>
journal.issueTypes.find(t => t.value === get(metadata, 'issue'))
......
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