Skip to content

Commit

Permalink
fallback to created by user data if audit info not available (#2569)
Browse files Browse the repository at this point in the history
  • Loading branch information
agalin920 authored Mar 14, 2024
1 parent 4c1b35d commit 3917c9c
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export const ItemEditHeaderActions = ({
useCreateItemPublishingMutation();
const [deleteItemPublishing, { isLoading: unpublishing }] =
useDeleteItemPublishingMutation();
const lastItemUpdateAudit = itemAudit?.find((audit) => audit.action === 2);
const lastItemUpdateAudit = itemAudit?.find(
(audit) => audit.action === 2 || audit.action === 1
);
const { data: itemPublishings, isFetching } = useGetItemPublishingsQuery({
modelZUID,
itemZUID,
Expand Down Expand Up @@ -206,8 +208,15 @@ export const ItemEditHeaderActions = ({
<div>
v{item?.meta?.version} saved on <br />
{formatDate(item?.meta?.updatedAt)} <br />
by {lastItemUpdateAudit?.firstName}{" "}
{lastItemUpdateAudit?.lastName}
by{" "}
{lastItemUpdateAudit?.firstName ||
users?.find(
(user) => user.ZUID === item?.meta?.createdByUserZUID
)?.firstName}{" "}
{lastItemUpdateAudit?.lastName ||
users?.find(
(user) => user.ZUID === item?.meta?.createdByUserZUID
)?.lastName}
</div>
)
}
Expand Down

0 comments on commit 3917c9c

Please sign in to comment.