Skip to content

feat: social leaderboard opt out#32982

Merged
Bigshmow merged 14 commits into
mainfrom
feat/social-leaderboard-opt-out
Jul 15, 2026
Merged

feat: social leaderboard opt out#32982
Bigshmow merged 14 commits into
mainfrom
feat/social-leaderboard-opt-out

Conversation

@Bigshmow

@Bigshmow Bigshmow commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a way for users to opt out of the Top Traders leaderboard from within the app.

Reason: MetaMask previously had no in-app way for a user to remove their account's addresses from the Top Traders leaderboard. @metamask/social-controllers@2.4.0 added the optOutOfLeaderboard capability (messenger action SocialController:optOutOfLeaderboard); this PR wires it into the mobile UI.

Solution:

  • Bumps @metamask/social-controllers from 2.3.12.4.0.
  • Adds a Top Traders entry to the app Settings list (rendered after "Buy & sell crypto", gated by selectSocialLeaderboardEnabled).
  • Adds a TopTradersSettings screen with an Opt out of leaderboard row.
  • Adds a LeaderboardOptOutBottomSheet (composed from the design-system BottomSheet, mirroring the existing TradingSignalsSetupBottomSheet) that calls SocialController:optOutOfLeaderboard, showing a loading/disabled state, closing on success, and logging + recovering on failure.
  • New routes SETTINGS.TOP_TRADERS and SOCIAL_LEADERBOARD.OPT_OUT with navigator registrations, param-list types, i18n strings, and testIDs.

Changelog

CHANGELOG entry: Added a Top Traders section in Settings that lets users opt out of the Top Traders leaderboard.

Related issues

Figma: https://www.figma.com/design/HzPB0InxHBY5hPkOukPCqv/Social?node-id=3017-31866&t=R8yrnl1Yo45ffgJO-4

Fixes: TSA-830

Manual testing steps

Feature: Opt out of the Top Traders leaderboard from Settings

  Scenario: user opts out of the leaderboard
    Given the Social Leaderboard feature flag is enabled
    And the user is on the Settings screen
    When the user taps "Top Traders"
    Then the Top Traders settings screen is shown with an "Opt out of leaderboard" option
    When the user taps "Opt out of leaderboard"
    Then a bottom sheet appears with the opt-out description and a confirm button
    When the user taps "Opt out of leaderboard" in the sheet
    Then the app calls SocialController:optOutOfLeaderboard
    And the sheet closes once the request succeeds

  Scenario: opt-out request fails
    Given the user has opened the opt-out bottom sheet
    When the user taps "Opt out of leaderboard"
    And the opt-out request fails
    Then the error is logged
    And the sheet stays open with the button re-enabled

  Scenario: leaderboard feature flag is disabled
    Given the Social Leaderboard feature flag is disabled
    When the user is on the Settings screen
    Then the "Top Traders" entry is not shown

Screenshots/Recordings

Before

Screenshot 2026-07-08 at 3 28 04 PM

After

Screenshot 2026-07-08 at 3 20 47 PM

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • 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.

Note

Medium Risk
Changes public visibility of trading accounts via backend opt-in/out; risk is mitigated by feature flags, non-optimistic persistence, and tests, but still touches privacy-sensitive social settings.

Overview
Adds a Top Traders block on Security & privacy so users can control whether their account appears on the leaderboard, behind both aiSocialLeaderboardEnabled and the new aiSocialLeaderboardOptFlowEnabled remote flag.

Toggling calls SocialController:optInToLeaderboard / optOutOfLeaderboard (with SocialService actions delegated on the social controller messenger). Redux settings.showAccountOnLeaderboard is updated only after a successful backend response (default shown); failures are logged and the toggle stays unchanged. A new MetaMetrics opt-in event Trader Leaderboard Visibility Toggled fires on success, and the section is covered by unit tests plus i18n and feature-flag registry entries.

Reviewed by Cursor Bugbot for commit f2929c3. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamask-ci metamask-ci Bot added INVALID-PR-TEMPLATE PR's body doesn't match template and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels Jul 8, 2026
@github-actions github-actions Bot added the size-M label Jul 8, 2026
@Bigshmow Bigshmow added the team-social-ai Social & AI team label Jul 8, 2026
@Bigshmow Bigshmow marked this pull request as ready for review July 8, 2026 22:21
@Bigshmow Bigshmow requested a review from a team as a code owner July 8, 2026 22:21
@github-actions github-actions Bot added the risk:high AI analysis: high risk label Jul 8, 2026

@joaosantos15 joaosantos15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a bug when trying to change the state :/

Image

@Bigshmow Bigshmow requested a review from a team as a code owner July 10, 2026 22:21
Bigshmow and others added 3 commits July 13, 2026 08:33
# Conflicts:
#	package.json
#	yarn.lock
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Bigshmow Bigshmow requested a review from a team as a code owner July 13, 2026 15:19

@joaosantos15 joaosantos15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock the request for changes so that @aganglada and @zone-live can review

joaosantos15
joaosantos15 previously approved these changes Jul 13, 2026
@zone-live

Copy link
Copy Markdown
Contributor

One thing to add next in a follow-up PR is metrics, I'm sure Rizvi will want to know if users are doing the opt-out 👍🏼

zone-live
zone-live previously approved these changes Jul 13, 2026
@Bigshmow Bigshmow dismissed stale reviews from zone-live and joaosantos15 via 992ae54 July 13, 2026 22:17
Comment on lines +60 to +63
createEventBuilder(
MetaMetricsEvents.SOCIAL_TRADER_LEADERBOARD_VISIBILITY_TOGGLED,
)
.addProperties({ show_account_on_leaderboard: enabled })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have the segment-schema PR prepared already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zone-live
zone-live previously approved these changes Jul 14, 2026
# Conflicts:
#	app/core/Analytics/MetaMetrics.events.ts
#	package.json
#	yarn.lock

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ac2d297. Configure here.

Comment thread app/components/Views/Settings/SecuritySettings/Sections/TopTradersSection.tsx Outdated
@github-actions github-actions Bot added risk:low AI analysis: low risk and removed risk:high AI analysis: high risk labels Jul 15, 2026
@Bigshmow Bigshmow enabled auto-merge July 15, 2026 16:58
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform, SmokePerps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 78%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR adds a new "Top Traders" leaderboard opt-in/opt-out toggle to the Security & Privacy Settings screen. Key observations:

  1. Feature-gated: The new TopTradersSection component is gated by aiSocialLeaderboardOptFlowEnabled feature flag which defaults to false in production. This means the new UI won't appear in standard test runs unless the flag is explicitly enabled.

  2. Additive changes: All changes are additive - new component, new Redux action/reducer field (with default value), new messenger actions, new analytics event, new feature flag registration. No existing functionality is modified.

  3. SecuritySettings.tsx modified: The main Security Settings screen now imports and renders TopTradersSection. Since the component returns null when feature flags are disabled, this has minimal impact on existing tests.

  4. Settings reducer: Added showAccountOnLeaderboard: true to initial state and a new reducer case. This is a shared reducer but the change is purely additive with a safe default.

  5. Social controller messenger: Added two new allowed actions (SocialService:optOutOfLeaderboard, SocialService:optInToLeaderboard) - purely additive.

  6. No existing smoke tests directly test the Security Settings screen with these new features (existing settings tests use RegressionWalletUX tag which is out of scope).

Tag selection rationale:

  • SmokeWalletPlatform: Covers wallet platform features including settings-related flows, analytics tracking, and the social/trading ecosystem. The new feature is part of the social trading platform.
  • SmokePerps: The leaderboard feature is directly related to the Perps/trading social features. The social controller messenger changes affect the same social service infrastructure used by Perps.

No performance tests are needed as these changes are UI/settings additions with no impact on app launch, asset loading, or other performance-sensitive flows.

Performance Test Selection:
The changes are purely additive UI/settings additions (new toggle in Security Settings, new Redux state, new messenger actions). None of these changes affect performance-sensitive flows like app launch, onboarding, login, asset loading, swaps, or account list rendering. The feature is also gated by a feature flag defaulting to false, further reducing any performance impact.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@Bigshmow Bigshmow added this pull request to the merge queue Jul 15, 2026
Merged via the queue into main with commit 96abde9 Jul 15, 2026
181 checks passed
@Bigshmow Bigshmow deleted the feat/social-leaderboard-opt-out branch July 15, 2026 18:14
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 15, 2026
@metamask-ci metamask-ci Bot added the release-8.4.0 Issue or pull request that will be included in release 8.4.0 label Jul 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.4.0 Issue or pull request that will be included in release 8.4.0 risk:low AI analysis: low risk size-M team-social-ai Social & AI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants