Skip to content

Commit

Permalink
restrict change history to contract actions for now
Browse files Browse the repository at this point in the history
  • Loading branch information
pearl-truss committed Apr 18, 2024
1 parent f555a3b commit 11d0268
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions services/app-web/src/components/ChangeHistory/ChangeHistoryV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export const ChangeHistoryV2 = ({
}: ChangeHistoryProps): React.ReactElement => {
const flattenedRevisions = (): flatRevisions[] => {
const result: flatRevisions[] = []
contract.packageSubmissions.forEach((r, index) => {
const contractSubmissions = contract.packageSubmissions.filter(
(submission) => {
return submission.cause === 'CONTRACT_SUBMISSION'
}
)
contractSubmissions.forEach((r, index) => {
if (r.contractRevision.unlockInfo) {
const newUnlock: flatRevisions = {} as flatRevisions
newUnlock.updatedAt = r.contractRevision.unlockInfo.updatedAt
Expand All @@ -30,18 +35,17 @@ export const ChangeHistoryV2 = ({
//Use unshift to push the latest revision unlock info to the beginning of the array
result.unshift(newUnlock)
}
if (r.contractRevision.submitInfo) {
if (r.submitInfo) {
const newSubmit: flatRevisions = {} as flatRevisions

const revisionVersion =
index !== contract.packageSubmissions.length - 1
? String(index + 1) //Offset version, we want to start at 1
: undefined

newSubmit.updatedAt = r.contractRevision.submitInfo.updatedAt
newSubmit.updatedBy = r.contractRevision.submitInfo.updatedBy
newSubmit.updatedReason =
r.contractRevision.submitInfo.updatedReason
newSubmit.updatedAt = r.submitInfo.updatedAt
newSubmit.updatedBy = r.submitInfo.updatedBy
newSubmit.updatedReason = r.submitInfo.updatedReason
newSubmit.kind = 'submit'
newSubmit.revisionVersion = revisionVersion
//Use unshift to push the latest revision submit info to the beginning of the array
Expand Down

0 comments on commit 11d0268

Please sign in to comment.