Skip to content

feat(social-controllers): add unblockProfile to SocialService - #11159

Merged
zone-live merged 2 commits into
mainfrom
feat/TSA-1418_unblock-profile
Oct 28, 2026
Merged

zone-live merged 2 commits into
mainfrom
feat/TSA-1418_unblock-profile

Conversation

@zone-live

@zone-live zone-live commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

SocialService can block a trader (PUT /v1/moderation/block) and list blocked traders (GET /v1/moderation/blocks/profiles), but it has no way to remove a block. social-api already serves DELETE /v1/moderation/blocks/profiles/:profileId for this. The route returns 204, is a no-op when the trader isn't blocked, and requires the profile id to be a UUID.

This PR adds SocialService.unblockProfile({ profileId }), exposed on the messenger as SocialService:unblockProfile. It works like block: it runs through fetchQuery with staleTime: 0, sends the JWT auth header, URL-encodes the profile id, and throws SocialServiceErrorMessage.UNBLOCK_PROFILE_FAILED on a non-2xx response.

Also in this PR:

  • New UnblockProfileOptions type, exported from the package root along with SocialServiceUnblockProfileAction.
  • Regenerated SocialService-method-action-types.ts with messenger-action-types:generate.

MetaMask Mobile will use this for the Unblock button on the Social trader profile.

References

  • Jira: TSA-1418
  • social-api route: ModerationController.unblockProfile (DELETE /v1/moderation/blocks/profiles/:profileId)

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Additive, non-breaking API that mirrors the existing block flow; no changes to auth or controller state.

Overview
Adds SocialService.unblockProfile({ profileId }) so clients can remove a trader block via DELETE /v1/moderation/blocks/profiles/:profileId, complementing existing block and fetchBlockedProfiles. Behavior matches other moderation mutations: JWT auth, URL-encoded profile id, fetchQuery with staleTime: 0, and SocialServiceErrorMessage.UNBLOCK_PROFILE_FAILED on non-2xx responses.

Also exports UnblockProfileOptions, registers SocialService:unblockProfile on the messenger, updates the changelog, and adds unit tests (HTTP shape, encoding, errors, cache bypass, messenger action). SocialController is unchanged—consumers (e.g. MetaMask Mobile Unblock) call the service action directly.

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

@zone-live
zone-live marked this pull request as ready for review October 28, 2026 12:31
@zone-live
zone-live requested review from a team as code owners October 28, 2026 12:31
@zone-live
zone-live enabled auto-merge October 28, 2026 15:09
@zone-live
zone-live disabled auto-merge October 28, 2026 15:56
@zone-live
zone-live added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 4176266 Oct 28, 2026
50 checks passed
@zone-live
zone-live deleted the feat/TSA-1418_unblock-profile branch October 28, 2026 16:02
@cursor cursor Bot mentioned this pull request Oct 29, 2026
4 tasks
darkwing pushed a commit to darkwing/metamask-mobile that referenced this pull request Oct 29, 2026
…#38386)

<!--
Please submit this PR as a draft initially.

Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.

In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.

  type=text           Section must contain non-placeholder prose.
  type=changelog      Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
                      comment but do not block the PR.

Sections without a directive are checked for structural presence only.
-->

## **Description**

<!-- mms-check: type=text required=true -->

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

Users can now block a trader from that trader's new SocialV1 profile.

**Flow**

- A new ellipsis button sits to the right of Share in the profile
header. It opens a **Profile options** bottom sheet with the block
explanation and a red **Block @name** button.
- Blocking:
- Records the block through `SocialService:block` (`PUT
/v1/moderation/block`).
- Unfollows the trader straight away if the user was following them,
using the existing `useFollowToggle` path.
- Hides the trader's activity: the stats row (Performance), the compact
header stats, the Open / Closed / Posts tabs, and their content. A "You
blocked @name" state takes their place.
  - Turns the Follow button into **Unblock**.
- Stops the 30-second positions polling and posts fetching while
blocked, since that data is hidden.
- **Unblock** calls `SocialService:unblockProfile` (`DELETE
/v1/moderation/blocks/profiles/:profileId`) and brings back the normal
profile. It does **not** follow the trader again.

<img height="136" alt="Screenshot 2026-10-29 at 11 08 56"
src="https://github.com/user-attachments/assets/38b375d7-057f-4b7a-b1f5-a04b099e17e5"
/>
<img height="285" alt="Screenshot 2026-10-29 at 11 09 01"
src="https://github.com/user-attachments/assets/91ccfc40-2884-4747-984d-db277174052b"
/>
<img height="800" alt="Screenshot iPhone 17 Pro 29-10-2026 at 10 45 32"
src="https://github.com/user-attachments/assets/ef2696de-2e44-4e5d-9d23-a12b66f8a25f"
/>
<img height="800" alt="Screenshot iPhone 17 Pro 29-10-2026 at 11 08 34"
src="https://github.com/user-attachments/assets/298828ca-3e34-4b67-8a0c-e376f6edd806"
/>
<img height="800" alt="Screenshot iPhone 17 Pro 28-10-2026 at 14 32 50"
src="https://github.com/user-attachments/assets/7872b603-8e25-4618-8de5-754dff1831b7"
/>



## **Changelog**

<!-- mms-check: type=changelog required=true blocking=true -->

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

<!-- mms-check: type=issue-link required=true -->

Fixes: https://consensyssoftware.atlassian.net/browse/TSA-1418

Refs: MetaMask/core#11159

## **Manual testing steps**

<!-- mms-check: type=manual-testing required=true -->

```gherkin
Feature: Block a trader from a SocialV1 profile

  Scenario: user blocks a followed trader
    Given the user is on another trader's SocialV1 profile
    And the user follows that trader

    When user taps the "..." button next to Share
    Then the "Profile options" sheet shows the block explanation and a "Block @name" button

    When user taps "Block @name"
    Then the sheet closes
    And the Performance stats, the Open / Closed / Posts tabs, and their content are hidden
    And "You blocked @name" is shown with the explanation copy
    And the Follow button reads "Unblock"
    And the trader is no longer in the user's following list

  Scenario: user unblocks a trader
    Given the user is on the profile of a trader they blocked

    When user taps "Unblock"
    Then the Performance stats and the Open / Closed / Posts tabs are shown again
    And the button reads "Follow"
    And the trader is not followed again

  Scenario: block state persists across visits
    Given the user blocked a trader

    When user leaves the profile and opens it again
    Then the profile still shows the blocked state
```

## **Screenshots/Recordings**

<!-- mms-check: type=screenshot required=true -->

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

### **Before**

NA

### **After**

NA

## **Pre-merge author checklist**

<!-- mms-check: type=checklist required=true -->

<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.

Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **Pre-merge reviewer checklist**

<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->

- [ ] 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.

<!-- Generated with the help of the pr-description AI skill -->


[TSA-1418]:
https://consensyssoftware.atlassian.net/browse/TSA-1418?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> User-facing moderation that calls SocialService and auto-unfollows on
block; optimistic state must stay in sync with the blocked-profiles
query.
> 
> **Overview**
> Adds **block/unblock** for other traders on the SocialV1 profile
screen (`MyProfileView`).
> 
> Viewing someone else’s profile now shows a header **⋯** control
(disabled until the live profile UUID loads) that opens a new
**`ProfileOptionsSheet`** with a destructive **Block @name** action.
Blocking goes through a new **`useTraderBlock`** hook and
**`traderBlockApi`** (`SocialService:block` / `unblockProfile`), with
optimistic UI that rolls back on failure and refetches the shared
blocked-profile list. If the viewer was following, block also
**unfollows** via the existing toggle path; **Unblock** restores the
normal profile without re-following.
> 
> While blocked, compact header stats, performance, tabs
(Open/Closed/Posts), and their data are hidden behind a **“You blocked
@name”** empty state; **Follow** becomes **Unblock**, and posts fetching
plus 30s position polling are paused. **`@metamask/social-controllers`**
is bumped to **^3.14.0**, with new copy and telemetry endpoints for
block/unblock. Coverage includes **`ProfileOptionsSheet`**,
**`useTraderBlock`**, and expanded **`MyProfileView`** tests.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0c0ed6d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Releases a new version for social-controllers package.


## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and changelog-only release; no runtime or API changes in this
diff.
> 
> **Overview**
> This PR **cuts a release** with no new implementation in the diff: it
bumps the monorepo to **1375.0.0** and `@metamask/social-controllers` to
**3.14.0**, and finalizes the package changelog for that version.
> 
> The new **[3.14.0]** section records
**`SocialService:unblockProfile`** (already merged via
[MetaMask#11159](https://github.com/MetaMask/core/pull/11159))—`DELETE
/v1/moderation/blocks/profiles/:profileId`, no-op when the trader was
not blocked, plus exported `UnblockProfileOptions` and
`SocialServiceUnblockProfileAction`. Compare links for `[Unreleased]`
and `[3.14.0]` are updated accordingly.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e76401b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

This branch was previously deployed

1 inactive deployment
default-branch — 26136068 Deployed Oct 28, 2026 by zone-live via Determine whether this PR is a release PR #6198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants