File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
packages/snaps-controllers/src/snaps Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -6861,7 +6861,7 @@ describe('SnapController', () => {
68616861 ) ;
68626862
68636863 expect ( snapControllerOptions . messenger . call ) . toHaveBeenNthCalledWith (
6864- 6 ,
6864+ 7 ,
68656865 'PermissionController:grantPermissions' ,
68666866 {
68676867 approvedPermissions : {
Original file line number Diff line number Diff line change @@ -1475,6 +1475,32 @@ export class SnapController extends BaseController<
14751475 isNonEmptyArray ( Object . keys ( newPermissions ) ) ||
14761476 isNonEmptyArray ( Object . keys ( unusedPermissions ) )
14771477 ) {
1478+ const { proposedName } = getLocalizedSnapManifest (
1479+ snap . manifest ,
1480+ 'en' ,
1481+ snap . localizationFiles ?? [ ] ,
1482+ ) ;
1483+
1484+ // Recover the SVG icon from the constructor argument.
1485+ // Theoretically this may be out of date, but this is the best we can do.
1486+ const preinstalledSnap = preinstalledSnaps . find (
1487+ ( potentialSnap ) => potentialSnap . snapId === snap . id ,
1488+ ) ;
1489+ const { iconPath } = snap . manifest . source . location . npm ;
1490+ const svgIcon =
1491+ iconPath && preinstalledSnap
1492+ ? preinstalledSnap . files . find ( ( file ) => file . path === iconPath )
1493+ : undefined ;
1494+
1495+ // If the permissions are out of sync, it is possible that the SubjectMetadataController also is.
1496+ this . messenger . call ( 'SubjectMetadataController:addSubjectMetadata' , {
1497+ subjectType : SubjectType . Snap ,
1498+ name : proposedName ,
1499+ origin : snap . id ,
1500+ version : snap . version ,
1501+ svgIcon : svgIcon ? new VirtualFile ( svgIcon ) . toString ( ) : null ,
1502+ } ) ;
1503+
14781504 this . #updatePermissions( {
14791505 snapId : snap . id ,
14801506 newPermissions,
You can’t perform that action at this time.
0 commit comments