Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(service-portal): fix defender info and alert #16275

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class LawAndOrderService {
const subpoena: SubpoenaResponse | undefined | null =
await this.api.getSubpoena(id, user, locale)

const defenderChoice = subpoena?.defenderInfo.defenderChoice
const defenderChoice = subpoena?.defenderInfo?.defenderChoice
const message = defenderChoice
? formatMessage(
DefenseChoices[subpoena?.defenderInfo.defenderChoice].message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const DocumentLineV3: FC<Props> = ({
const displayPdf = (
content?: DocumentV2Content,
actions?: Array<DocumentV2Action>,
alertMessageData?: DocumentV2Action,
) => {
setActiveDocument({
document: {
Expand All @@ -121,7 +122,7 @@ export const DocumentLineV3: FC<Props> = ({
img,
categoryId: documentLine.categoryId ?? undefined,
actions: actions,
alert: documentLine.alert ?? undefined,
alert: alertMessageData ?? undefined,
})
window.scrollTo({
top: 0,
Expand Down Expand Up @@ -155,8 +156,9 @@ export const DocumentLineV3: FC<Props> = ({
} else {
const docContent = data?.documentV2?.content
const actions = data?.documentV2?.actions ?? undefined
const alert = data?.documentV2?.alert ?? undefined
if (docContent) {
displayPdf(docContent, actions)
displayPdf(docContent, actions, alert)
setDocumentDisplayError(undefined)
setLocalRead([...localRead, documentLine.id])
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const Subpoena = () => {

const subpoena = data?.lawAndOrderSubpoena
const [defenderPopUp, setDefenderPopUp] = useState<boolean>(false)

if (
subpoena?.data &&
(!isDefined(subpoena.data.hasBeenServed) ||
Expand Down Expand Up @@ -121,7 +120,7 @@ const Subpoena = () => {
action: () => {
setDefenderPopUp(true)
},
disabled: !subpoena.data.canEditDefenderChoice,
disabled: subpoena.data.canEditDefenderChoice === false,
tooltip: subpoena.data.canEditDefenderChoice
? undefined
: subpoena.data.courtContactInfo ?? '',
Expand All @@ -138,7 +137,7 @@ const Subpoena = () => {
<Text>{formatMessage(messages.subpoenaInfoText2)}</Text>
</Box>

{!loading && !subpoena?.data.defenderChoice && (
{!loading && subpoena.data.canEditDefenderChoice === null && (
<DefenderChoices id={id} refetch={refetch} />
)}

Expand Down
Loading