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: updated permissions header to be consistent #29880

Merged
merged 5 commits into from
Jan 24, 2025
Merged
Changes from 3 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
32 changes: 22 additions & 10 deletions ui/pages/permissions-connect/permissions-connect.component.js
NidhiKJha marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@
this.props.permissionsRequest,
),
permissionsApproved: null,
origin: this.props.origin,
targetSubjectMetadata: this.props.targetSubjectMetadata || {},
snapsInstallPrivacyWarningShown: this.props.snapsInstallPrivacyWarningShown,
};

componentDidMount() {
Expand All @@ -152,8 +155,7 @@
if (!permissionsRequest) {
history.replace(DEFAULT_ROUTE);
return;
}

}

Check failure on line 158 in ui/pages/permissions-connect/permissions-connect.component.js

View workflow job for this annotation

GitHub Actions / Test lint / Test lint

Delete `···`
if (history.location.pathname === connectPath && !isRequestingAccounts) {
switch (requestType) {
case 'wallet_installSnap':
Expand All @@ -175,8 +177,16 @@
}

componentDidUpdate(prevProps) {
const { permissionsRequest, lastConnectedInfo, origin } = this.props;
const { redirecting } = this.state;
const { permissionsRequest, lastConnectedInfo, targetSubjectMetadata } =
this.props;
const { redirecting, origin } = this.state;

if (
NidhiKJha marked this conversation as resolved.
Show resolved Hide resolved
targetSubjectMetadata?.origin &&
prevProps.targetSubjectMetadata?.origin !== targetSubjectMetadata?.origin
) {
this.setState({ targetSubjectMetadata });
}

if (!permissionsRequest && prevProps.permissionsRequest && !redirecting) {
const accountsLastApprovedTime =
Expand Down Expand Up @@ -262,7 +272,7 @@
}

renderTopBar(permissionsRequestId) {
const { targetSubjectMetadata } = this.props;
const { targetSubjectMetadata } = this.state;
const handleCancelFromHeader = () => {
this.cancelPermissionsRequest(permissionsRequestId);
};
Expand Down Expand Up @@ -319,12 +329,14 @@
rejectPendingApproval,
setSnapsInstallPrivacyWarningShownStatus,
approvePermissionsRequest,
snapsInstallPrivacyWarningShown,
origin,
history,
} = this.props;
const { selectedAccountAddresses, permissionsApproved, redirecting } =
this.state;
const {
selectedAccountAddresses,
permissionsApproved,
redirecting,
snapsInstallPrivacyWarningShown,
} = this.state;

const isRequestingSnap = isSnapId(permissionsRequest?.metadata?.origin);

Expand Down Expand Up @@ -366,7 +378,7 @@
rejectPermissionsRequest={(requestId) =>
this.cancelPermissionsRequest(requestId)
}
activeTabOrigin={origin}
activeTabOrigin={this.state.origin}
request={permissionsRequest}
permissionsRequestId={permissionsRequestId}
approveConnection={this.approveConnection}
Expand Down
Loading