diff --git a/static/src/js/components/RevisionList/RevisionList.jsx b/static/src/js/components/RevisionList/RevisionList.jsx index fe4be9bf0..38b338688 100644 --- a/static/src/js/components/RevisionList/RevisionList.jsx +++ b/static/src/js/components/RevisionList/RevisionList.jsx @@ -42,30 +42,25 @@ const RevisionList = () => { }) const { [derivedConceptType.toLowerCase()]: concept } = data - const { revisions } = concept + const { revisions, revisionId: conceptRevisionId } = concept const { count, items } = revisions const buildDescriptionCell = useCallback((cellData, rowData) => { - const published = rowData.revisionId === concept.revisionId - - const { revisionId, userId } = rowData - // Temporary Solution from MMT-3946 until we can pass up a tombstone type instead - const isDeleted = userId === 'cmr' + const { revisionId: rowDataRevisionId } = rowData + const isPublished = rowDataRevisionId === conceptRevisionId let descriptionCellContent - if (published) { + if (isPublished) { descriptionCellContent = ( - {[revisionId, ' - Published'].join('')} + {[rowDataRevisionId, ' - Published'].join('')} ) - } else if (!published && isDeleted) { - descriptionCellContent = `${revisionId} - Deleted` } else { descriptionCellContent = ( - - {[revisionId, ' - Revision'].join('')} + + {[rowDataRevisionId, ' - Revision'].join('')} ) } @@ -108,27 +103,23 @@ const RevisionList = () => { } const buildActionCell = useCallback((cellData, rowData) => { - const { revisionId, userId } = rowData + const { revisionId: rowDataRevisionId } = rowData const { revisionId: currRevisionId } = concept - const isPublished = revisionId === currRevisionId - // Temporary Solution from MMT-3946 until we can pass up a tombstone type instead - const isDeleted = userId === 'cmr' + const isPublished = rowDataRevisionId === currRevisionId let actionCellContent - if (!isPublished && !isDeleted) { + if (!isPublished) { actionCellContent = ( ) - } else if (!isPublished && isDeleted) { - actionCellContent = 'deleted' } else { actionCellContent = null } diff --git a/static/src/js/components/RevisionList/__tests__/RevisionList.test.jsx b/static/src/js/components/RevisionList/__tests__/RevisionList.test.jsx index 17ef86f20..402b1eacb 100644 --- a/static/src/js/components/RevisionList/__tests__/RevisionList.test.jsx +++ b/static/src/js/components/RevisionList/__tests__/RevisionList.test.jsx @@ -12,10 +12,7 @@ import { } from 'react-router-dom' import userEvent from '@testing-library/user-event' -import { - collectionRevisions, - collectionRevisionsWithDeletedRevision -} from './__mocks__/revisionResults' +import { collectionRevisions } from './__mocks__/revisionResults' import RevisionList from '../RevisionList' import ErrorBoundary from '../../ErrorBoundary/ErrorBoundary' @@ -121,37 +118,6 @@ describe('RevisionList component', () => { }) }) - // Temporary solution from MMT-3946. We are determining that a revision has been deleted if its userId === cmr - describe('when there is a revision with userid === cmr', () => { - test('renders the revisions and indicates which of them has been deleted', async () => { - setup({ overrideMocks: [collectionRevisionsWithDeletedRevision] }) - - expect(screen.queryByText('Loading...')) - - const tableRows = await screen.findAllByRole('row') - expect(tableRows.length).toEqual(3) - - const date = new Date(2000, 1, 1, 13) - vi.setSystemTime(date) - const rows = screen.queryAllByRole('row') - const row1 = rows[1] - const row2 = rows[2] - - const row1Cells = within(row1).queryAllByRole('cell') - const row2Cells = within(row2).queryAllByRole('cell') - expect(row1Cells).toHaveLength(4) - expect(row1Cells[0].textContent).toBe('8 - Published') - expect(row1Cells[1].textContent).toBe('Tuesday, February 1, 2000 6:00 PM') - expect(row1Cells[2].textContent).toBe('admin') - expect(row1Cells[3].textContent).toBe('') - - expect(row2Cells).toHaveLength(4) - expect(row2Cells[0].textContent).toBe('7 - Deleted') - expect(row2Cells[2].textContent).toBe('cmr') - expect(row2Cells[3].textContent).toBe('deleted') - }) - }) - describe('when reverting to a revision results in a success', () => { test('should call restore to revision mutation', async () => { const { user } = setup({ diff --git a/static/src/js/components/RevisionList/__tests__/__mocks__/revisionResults.js b/static/src/js/components/RevisionList/__tests__/__mocks__/revisionResults.js index c0a474b8f..612653680 100644 --- a/static/src/js/components/RevisionList/__tests__/__mocks__/revisionResults.js +++ b/static/src/js/components/RevisionList/__tests__/__mocks__/revisionResults.js @@ -3304,43 +3304,3 @@ export const revertCollectionRevision = { } } } - -// We are considering 'deleted' when userId === 'cmr' for now. Will come back better solution has been created -export const collectionRevisionsWithDeletedRevision = { - request: { - query: GET_COLLECTION, - variables: { - params: { - conceptId: 'C1200000104-MMT_2' - } - } - }, - result: { - data: { - collection: { - revisionId: '8', - revisions: { - count: 8, - items: [ - { - conceptId: 'C1200000104-MMT_2', - revisionDate: '2000-02-01T18:00:00.000Z', - revisionId: '8', - userId: 'admin', - __typename: 'Collection' - }, - { - conceptId: 'C1200000104-MMT_2', - revisionDate: '2024-04-24T16:37:11.849Z', - revisionId: '7', - userId: 'cmr', - __typename: 'Collection' - } - ], - __typename: 'CollectionRevisionList' - }, - __typename: 'Collection' - } - } - } -}