Skip to content

Commit

Permalink
Fixed few issues
Browse files Browse the repository at this point in the history
  • Loading branch information
filipsekulic committed Feb 21, 2023
1 parent c72bed0 commit 85db441
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 20 deletions.
6 changes: 6 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ export default class ConfirmPageContainerContent extends Component {
{ethGasPriceWarning && (
<ConfirmPageContainerWarning warning={ethGasPriceWarning} />
)}
{txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
{(txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
txData?.securityProviderResponse?.flagAsDangerous !==
SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS && (
<SecurityProviderBannerMessage
securityProviderResponse={txData.securityProviderResponse}
/>
)}
SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS) ||
(txData?.securityProviderResponse &&
Object.keys(txData.securityProviderResponse).length === 0) ? (
<SecurityProviderBannerMessage
securityProviderResponse={txData.securityProviderResponse}
/>
) : null}
<ConfirmPageContainerSummary
className={classnames({
'confirm-page-container-summary--border':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ export default function SecurityProviderBannerMessage({
securityProviderResponse.flagAsDangerous ===
SECURITY_PROVIDER_MESSAGE_SEVERITIES.MALICIOUS
) {
messageTitle = securityProviderResponse.reason_header;
messageText = securityProviderResponse.reason;
messageTitle =
securityProviderResponse.reason_header === ''
? t('requestFlaggedAsMaliciousFallbackCopyReasonTitle')
: securityProviderResponse.reason_header;
messageText =
securityProviderResponse.reason === ''
? t('requestFlaggedAsMaliciousFallbackCopyReason')
: securityProviderResponse.reason;
severity = SEVERITIES.DANGER;
} else if (
securityProviderResponse.flagAsDangerous ===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ export default class SignatureRequestOriginal extends Component {

return (
<div className="request-signature__body">
{txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
{(txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
txData?.securityProviderResponse?.flagAsDangerous !==
SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS && (
<SecurityProviderBannerMessage
securityProviderResponse={txData.securityProviderResponse}
/>
)}
SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS) ||
(txData?.securityProviderResponse &&
Object.keys(txData.securityProviderResponse).length === 0) ? (
<SecurityProviderBannerMessage
securityProviderResponse={txData.securityProviderResponse}
/>
) : null}
<div className="request-signature__origin">
<SiteOrigin
siteOrigin={txData.msgParams.origin}
Expand Down
11 changes: 11 additions & 0 deletions ui/components/app/signature-request-siwe/signature-request-siwe.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { formatMessageParams } from '../../../../shared/modules/siwe';
import { Icon } from '../../component-library/icon/icon';
import { IconColor } from '../../../helpers/constants/design-system';

import SecurityProviderBannerMessage from '../security-provider-banner-message/security-provider-banner-message';
import { SECURITY_PROVIDER_MESSAGE_SEVERITIES } from '../security-provider-banner-message/security-provider-banner-message.constants';
import Header from './signature-request-siwe-header';
import Message from './signature-request-siwe-message';

Expand Down Expand Up @@ -88,6 +90,15 @@ export default function SignatureRequestSIWE({
isSIWEDomainValid={isSIWEDomainValid}
subjectMetadata={targetSubjectMetadata}
/>
{(txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
txData?.securityProviderResponse?.flagAsDangerous !==
SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS) ||
(txData?.securityProviderResponse &&
Object.keys(txData.securityProviderResponse).length === 0) ? (
<SecurityProviderBannerMessage
securityProviderResponse={txData.securityProviderResponse}
/>
) : null}
<Message data={formatMessageParams(parsedMessage, t)} />
{!isMatchingAddress && (
<ActionableMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,15 @@ export default class SignatureRequest extends PureComponent {
/>
</div>
<div className="signature-request-content">
{txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
{(txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
txData?.securityProviderResponse?.flagAsDangerous !==
SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS && (
<SecurityProviderBannerMessage
securityProviderResponse={txData.securityProviderResponse}
/>
)}
SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS) ||
(txData?.securityProviderResponse &&
Object.keys(txData.securityProviderResponse).length === 0) ? (
<SecurityProviderBannerMessage
securityProviderResponse={txData.securityProviderResponse}
/>
) : null}
<div className="signature-request__origin">
<SiteOrigin
siteOrigin={origin}
Expand Down

0 comments on commit 85db441

Please sign in to comment.