Skip to content

Commit

Permalink
Only get snap name if it's a snap dialog (#21088)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeRx committed Sep 28, 2023
1 parent 0f7b7f3 commit 993be35
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ui/pages/confirmation/confirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,19 @@ export default function ConfirmationPage({
getTargetSubjectMetadata(state, pendingConfirmation?.origin),
);

// When pendingConfirmation is undefined, this will also be undefined
const snapName =
targetSubjectMetadata &&
getSnapName(pendingConfirmation?.origin, targetSubjectMetadata);

const SNAP_DIALOG_TYPE = [
ApprovalType.SnapDialogAlert,
ApprovalType.SnapDialogConfirmation,
ApprovalType.SnapDialogPrompt,
];

const isSnapDialog = SNAP_DIALOG_TYPE.includes(pendingConfirmation?.type);

// When pendingConfirmation is undefined, this will also be undefined
const snapName =
isSnapDialog &&
targetSubjectMetadata &&
getSnapName(pendingConfirmation?.origin, targetSubjectMetadata);
///: END:ONLY_INCLUDE_IN

const INPUT_STATE_CONFIRMATIONS = [
Expand Down

0 comments on commit 993be35

Please sign in to comment.