Skip to content

Commit

Permalink
chore: change ownership of profile sync from notifications to identity (
Browse files Browse the repository at this point in the history
#28901)

## **Description**

This PR takes care of all the necessary changes in order to decouple
"Profile Sync" from the notifications feature.
This also underlines the ownership change from @MetaMask/notifications
to @MetaMask/identity.

The changes made here will help transitioning to cleaner separation of
concerns for features leveraging profile sync (i.e Notifications,
Account syncing...).

⚠️ This PR does not add missing tests nor introduces any changes. This
is only moving files around and separating concerns.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28901?quickstart=1)

## **Related issues**

Fixes #28900

## **Manual testing steps**

No testing steps since this PR does not change the implementation of
existing features.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: Mark Stacey <[email protected]>
  • Loading branch information
mathieuartu and Gudahtt authored Dec 4, 2024
1 parent b1e173a commit 79de169
Show file tree
Hide file tree
Showing 29 changed files with 36 additions and 33 deletions.
11 changes: 7 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,24 @@ ui/selectors/institutional @MetaMask/mmi
# Slack handle: @metamask-design-system-team | Slack channel: #metamask-design-system
ui/components/component-library @MetaMask/design-system-engineers

# The Notifications team is responsible for code related to notifications,
# authentication, and profile syncing inside the Extension.
# The Notifications team is responsible for code related to notifications

# Controllers
**/controllers/authentication/** @MetaMask/notifications
**/controllers/metamask-notifications/** @MetaMask/notifications
**/controllers/push-platform-notifications/** @MetaMask/notifications
**/controllers/user-storage/** @MetaMask/notifications

# UI
**/metamask-notifications/** @MetaMask/notifications
**/multichain/notification*/** @MetaMask/notifications
**/pages/notification*/** @MetaMask/notifications
**/utils/notification.util.ts @MetaMask/notifications

# Identity team is responsible for authentication and profile syncing inside the Extension.
# Slack handle: @identity_team | Slack channel: #metamask-identity
**/identity/** @MetaMask/identity
ui/pages/settings/security-tab/profile-sync-toggle @MetaMask/identity


# Accounts team is responsible for code related with snap management accounts
# Slack handle: @accounts-team-devs | Slack channel: #metamask-accounts-team

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
import { MetaMetricsContext } from '../../../contexts/metametrics';
import { getUseExternalServices } from '../../../selectors';
import { selectIsMetamaskNotificationsEnabled } from '../../../selectors/metamask-notifications/metamask-notifications';
import { selectIsProfileSyncingEnabled } from '../../../selectors/metamask-notifications/profile-syncing';
import { selectIsProfileSyncingEnabled } from '../../../selectors/identity/profile-syncing';
import {
hideBasicFunctionalityModal,
onboardingToggleBasicFunctionalityOff,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react';
import { useModalProps } from '../../../../hooks/useModalProps';
import { useDisableProfileSyncing } from '../../../../hooks/metamask-notifications/useProfileSyncing';
import { useDisableProfileSyncing } from '../../../../hooks/identity/useProfileSyncing';
import { I18nContext } from '../../../../contexts/i18n';
import ConfirmTurnOffProfileSyncing from './confirm-turn-off-profile-syncing';

jest.mock('../../../../hooks/useModalProps', () => ({
useModalProps: jest.fn(),
}));

jest.mock('../../../../hooks/metamask-notifications/useProfileSyncing', () => ({
jest.mock('../../../../hooks/identity/useProfileSyncing', () => ({
useDisableProfileSyncing: jest.fn(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
selectIsMetamaskNotificationsEnabled,
getIsUpdatingMetamaskNotifications,
} from '../../../../selectors/metamask-notifications/metamask-notifications';
import { selectIsProfileSyncingEnabled } from '../../../../selectors/metamask-notifications/profile-syncing';
import { selectIsProfileSyncingEnabled } from '../../../../selectors/identity/profile-syncing';
import { useCreateNotifications } from '../../../../hooks/metamask-notifications/useNotifications';
import { NOTIFICATIONS_ROUTE } from '../../../../helpers/constants/routes';

Expand Down
2 changes: 1 addition & 1 deletion ui/components/multichain/global-menu/global-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
selectIsMetamaskNotificationsEnabled,
selectIsMetamaskNotificationsFeatureSeen,
} from '../../../selectors/metamask-notifications/metamask-notifications';
import { selectIsProfileSyncingEnabled } from '../../../selectors/metamask-notifications/profile-syncing';
import { selectIsProfileSyncingEnabled } from '../../../selectors/identity/profile-syncing';
import {
Box,
IconName,
Expand Down
4 changes: 2 additions & 2 deletions ui/contexts/metamask-notifications/metamask-notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { createContext, useContext, useEffect, useMemo } from 'react';
import { useSelector } from 'react-redux';
import type { NotificationServicesController } from '@metamask/notification-services-controller';
import { useListNotifications } from '../../hooks/metamask-notifications/useNotifications';
import { useAccountSyncingEffect } from '../../hooks/metamask-notifications/useProfileSyncing';
import { selectIsProfileSyncingEnabled } from '../../selectors/metamask-notifications/profile-syncing';
import { useAccountSyncingEffect } from '../../hooks/identity/useProfileSyncing';
import { selectIsProfileSyncingEnabled } from '../../selectors/identity/profile-syncing';
import { selectIsMetamaskNotificationsEnabled } from '../../selectors/metamask-notifications/metamask-notifications';
import { getUseExternalServices } from '../../selectors';
import { getIsUnlocked } from '../../ducks/metamask/metamask';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import log from 'loglevel';
import {
selectIsSignedIn,
selectParticipateInMetaMetrics,
} from '../../selectors/metamask-notifications/authentication';
import { selectIsProfileSyncingEnabled } from '../../selectors/metamask-notifications/profile-syncing';
} from '../../selectors/identity/authentication';
import { selectIsProfileSyncingEnabled } from '../../selectors/identity/profile-syncing';
import { performSignIn, disableProfileSyncing } from '../../store/actions';

/**
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState, useCallback } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import log from 'loglevel';
import { selectIsSignedIn } from '../../selectors/metamask-notifications/authentication';
import { selectIsProfileSyncingEnabled } from '../../selectors/metamask-notifications/profile-syncing';
import { selectIsSignedIn } from '../../selectors/identity/authentication';
import { selectIsProfileSyncingEnabled } from '../../selectors/identity/profile-syncing';
import {
performSignOut,
performSignIn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
hideLoadingIndication,
} from '../../../store/actions';

import { selectIsSignedIn } from '../../../selectors/metamask-notifications/authentication';
import { selectIsSignedIn } from '../../../selectors/identity/authentication';
import {
selectIsAccountSyncingReadyToBeDispatched,
selectIsProfileSyncingEnabled,
} from '../../../selectors/metamask-notifications/profile-syncing';
} from '../../../selectors/identity/profile-syncing';
import { getUseExternalServices } from '../../../selectors';
import {
getIsUnlocked,
Expand Down
2 changes: 1 addition & 1 deletion ui/hooks/metamask-notifications/useNotifications.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jest.mock('../../store/actions', () => ({
disableMetamaskNotifications: jest.fn(),
}));

jest.mock('./useProfileSyncing', () => ({
jest.mock('../identity/useProfileSyncing', () => ({
useEnableProfileSyncing: jest.fn(() => ({
enableProfileSyncing: jest.fn(),
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
selectIsMetamaskNotificationsEnabled,
getIsUpdatingMetamaskNotifications,
} from '../../selectors/metamask-notifications/metamask-notifications';
import { selectIsProfileSyncingEnabled } from '../../selectors/metamask-notifications/profile-syncing';
import { selectIsProfileSyncingEnabled } from '../../selectors/identity/profile-syncing';
import { useMetamaskNotificationsContext } from '../../contexts/metamask-notifications/metamask-notifications';
import { Box, Text } from '../../components/component-library';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import {
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import { useCreateSession } from '../../../hooks/metamask-notifications/useCreateSession';
import { selectIsProfileSyncingEnabled } from '../../../selectors/metamask-notifications/profile-syncing';
import { useCreateSession } from '../../../hooks/identity/useCreateSession';
import { selectIsProfileSyncingEnabled } from '../../../selectors/identity/profile-syncing';

export default function CreationSuccessful() {
const history = useHistory();
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/onboarding-flow/pin-extension/pin-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import {
getFirstTimeFlowType,
getExternalServicesOnboardingToggleState,
} from '../../../selectors';
import { selectIsProfileSyncingEnabled } from '../../../selectors/metamask-notifications/profile-syncing';
import { selectParticipateInMetaMetrics } from '../../../selectors/metamask-notifications/authentication';
import { selectIsProfileSyncingEnabled } from '../../../selectors/identity/profile-syncing';
import { selectParticipateInMetaMetrics } from '../../../selectors/identity/authentication';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/onboarding-flow/privacy-settings/privacy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { addUrlProtocolPrefix } from '../../../../app/scripts/lib/util';
import {
useSetIsProfileSyncingEnabled,
useEnableProfileSyncing,
} from '../../../hooks/metamask-notifications/useProfileSyncing';
} from '../../../hooks/identity/useProfileSyncing';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
Expand Down Expand Up @@ -53,7 +53,7 @@ import {
getExternalServicesOnboardingToggleState,
} from '../../../selectors';
import { getNetworkConfigurationsByChainId } from '../../../../shared/modules/selectors/networks';
import { selectIsProfileSyncingEnabled } from '../../../selectors/metamask-notifications/profile-syncing';
import { selectIsProfileSyncingEnabled } from '../../../selectors/identity/profile-syncing';
import {
setIpfsGateway,
setUseCurrencyRateCheck,
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/settings/developer-options-tab/profile-sync.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
JustifyContent,
AlignItems,
} from '../../../helpers/constants/design-system';
import { useDeleteAccountSyncingDataFromUserStorage } from '../../../hooks/metamask-notifications/useProfileSyncing';
import { useDeleteAccountSyncingDataFromUserStorage } from '../../../hooks/identity/useProfileSyncing';

const AccountSyncDeleteDataFromUserStorage = () => {
const [hasDeletedAccountSyncEntries, setHasDeletedAccountSyncEntries] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Provider } from 'react-redux';
import configureMockStore from 'redux-mock-store';
import { render, fireEvent } from '@testing-library/react';
import * as MetametricsHooks from '../../../../hooks/metamask-notifications/useMetametrics';
import * as MetametricsHooks from '../../../../hooks/identity/useMetametrics';
import MetametricsToggle from './metametrics-toggle';

let mockUseSelectorReturnValue = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { MetaMetricsContext } from '../../../../contexts/metametrics';
import {
useEnableMetametrics,
useDisableMetametrics,
} from '../../../../hooks/metamask-notifications/useMetametrics';
import { selectIsProfileSyncingEnabled } from '../../../../selectors/metamask-notifications/profile-syncing';
import { selectParticipateInMetaMetrics } from '../../../../selectors/metamask-notifications/authentication';
} from '../../../../hooks/identity/useMetametrics';
import { selectIsProfileSyncingEnabled } from '../../../../selectors/identity/profile-syncing';
import { selectParticipateInMetaMetrics } from '../../../../selectors/identity/authentication';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Redux from 'react-redux';
import configureMockStore from 'redux-mock-store';
import { render, fireEvent } from '@testing-library/react';
import { MetamaskNotificationsProvider } from '../../../../contexts/metamask-notifications';
import * as ProfileSyncingHook from '../../../../hooks/metamask-notifications/useProfileSyncing/profileSyncing';
import * as ProfileSyncingHook from '../../../../hooks/identity/useProfileSyncing/profileSyncing';
import ProfileSyncToggle from './profile-sync-toggle';

const mockStore = configureMockStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { MetaMetricsContext } from '../../../../contexts/metametrics';
import {
useEnableProfileSyncing,
useDisableProfileSyncing,
} from '../../../../hooks/metamask-notifications/useProfileSyncing';
} from '../../../../hooks/identity/useProfileSyncing';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../../shared/constants/metametrics';
import {
selectIsProfileSyncingEnabled,
selectIsProfileSyncingUpdateLoading,
} from '../../../../selectors/metamask-notifications/profile-syncing';
} from '../../../../selectors/identity/profile-syncing';
import { selectIsMetamaskNotificationsEnabled } from '../../../../selectors/metamask-notifications/metamask-notifications';
import { showModal } from '../../../../store/actions';
import { Box, Text } from '../../../../components/component-library';
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 79de169

Please sign in to comment.