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

Add case for non ipfs metadata when open sea API is off on nft contro… #1772

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

pedronfigueiredo
Copy link
Contributor

…ller

Explanation

Currently, if a user has the IPFS toggle on and the open sea API toggle off (which is the default case), they are able to import an NFT manually even if the metadata (tokenURI) has been hosted in a non-ipfs URL.

This PR fixes this by returning empty data instead of sourcing it from open sea.

References

Fixes: https://app.zenhub.com/workspaces/metamask-extension-63529dce65cbb100265a3842/issues/gh/metamask/metamask-planning/1380

Changelog

@metamask/assets-controllers

  • CHANGED: Return empty metadata object when the IPFS gateway has been enabled by the user and the open sea API has been disabled.

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 highlighted breaking changes using the "BREAKING" category above as appropriate

@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner October 4, 2023 14:06
@pedronfigueiredo pedronfigueiredo self-assigned this Oct 4, 2023
@gauthierpetetin
Copy link
Contributor

LGTM
Long term though, we may want to rename this.config.openSeaEnabled into this.config.isDisplayNFTMediaToggleEnabled to avoid confusion.

@pedronfigueiredo pedronfigueiredo merged commit bc04f49 into main Oct 10, 2023
107 checks passed
@pedronfigueiredo pedronfigueiredo deleted the mmp-1380 branch October 10, 2023 08:44
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
#1772)

…ller

## Explanation

Currently, if a user has the IPFS toggle on and the open sea API toggle
off (which is the default case), they are able to import an NFT manually
even if the metadata (tokenURI) has been hosted in a non-ipfs URL.

This PR fixes this by returning empty data instead of sourcing it from
open sea.


## References

Fixes:
https://app.zenhub.com/workspaces/metamask-extension-63529dce65cbb100265a3842/issues/gh/metamask/metamask-planning/1380

## Changelog

### `@metamask/assets-controllers`

- **CHANGED**: Return empty metadata object when the IPFS gateway has
been enabled by the user and the open sea API has been disabled.

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
#1772)

…ller

## Explanation

Currently, if a user has the IPFS toggle on and the open sea API toggle
off (which is the default case), they are able to import an NFT manually
even if the metadata (tokenURI) has been hosted in a non-ipfs URL.

This PR fixes this by returning empty data instead of sourcing it from
open sea.


## References

Fixes:
https://app.zenhub.com/workspaces/metamask-extension-63529dce65cbb100265a3842/issues/gh/metamask/metamask-planning/1380

## Changelog

### `@metamask/assets-controllers`

- **CHANGED**: Return empty metadata object when the IPFS gateway has
been enabled by the user and the open sea API has been disabled.

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
MajorLift pushed a commit that referenced this pull request Oct 12, 2023
#1772)

…ller

## Explanation

Currently, if a user has the IPFS toggle on and the open sea API toggle
off (which is the default case), they are able to import an NFT manually
even if the metadata (tokenURI) has been hosted in a non-ipfs URL.

This PR fixes this by returning empty data instead of sourcing it from
open sea.


## References

Fixes:
https://app.zenhub.com/workspaces/metamask-extension-63529dce65cbb100265a3842/issues/gh/metamask/metamask-planning/1380

## Changelog

### `@metamask/assets-controllers`

- **CHANGED**: Return empty metadata object when the IPFS gateway has
been enabled by the user and the open sea API has been disabled.

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
pedronfigueiredo added a commit that referenced this pull request Oct 12, 2023
#1772)

…ller

## Explanation

Currently, if a user has the IPFS toggle on and the open sea API toggle
off (which is the default case), they are able to import an NFT manually
even if the metadata (tokenURI) has been hosted in a non-ipfs URL.

This PR fixes this by returning empty data instead of sourcing it from
open sea.


## References

Fixes:
https://app.zenhub.com/workspaces/metamask-extension-63529dce65cbb100265a3842/issues/gh/metamask/metamask-planning/1380

## Changelog

### `@metamask/assets-controllers`

- **CHANGED**: Return empty metadata object when the IPFS gateway has
been enabled by the user and the open sea API has been disabled.

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
pedronfigueiredo added a commit that referenced this pull request Oct 12, 2023
#1772)

…ller

## Explanation

Currently, if a user has the IPFS toggle on and the open sea API toggle
off (which is the default case), they are able to import an NFT manually
even if the metadata (tokenURI) has been hosted in a non-ipfs URL.

This PR fixes this by returning empty data instead of sourcing it from
open sea.


## References

Fixes:
https://app.zenhub.com/workspaces/metamask-extension-63529dce65cbb100265a3842/issues/gh/metamask/metamask-planning/1380

## Changelog

### `@metamask/assets-controllers`

- **CHANGED**: Return empty metadata object when the IPFS gateway has
been enabled by the user and the open sea API has been disabled.

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
pedronfigueiredo added a commit that referenced this pull request Oct 12, 2023
#1828)

…… (#1772)

…ller

## Explanation

Currently, if a user has the IPFS toggle on and the open sea API toggle
off (which is the default case), they are able to import an NFT manually
even if the metadata (tokenURI) has been hosted in a non-ipfs URL.

This PR fixes this by returning empty data instead of sourcing it from
open sea.


## References

Fixes:

https://app.zenhub.com/workspaces/metamask-extension-63529dce65cbb100265a3842/issues/gh/metamask/metamask-planning/1380

## Changelog

### `@metamask/assets-controllers`

- **CHANGED**: Return empty metadata object when the IPFS gateway has
been enabled by the user and the open sea API has been disabled.

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate

## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

## 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?

For example:

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

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/package-a`

- **<CATEGORY>**: Your change here
- **<CATEGORY>**: Your change here

### `@metamask/package-b`

- **<CATEGORY>**: Your change here
- **<CATEGORY>**: Your change here

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
pedronfigueiredo added a commit to MetaMask/metamask-extension that referenced this pull request Nov 15, 2023
## **Description**

This PR cherry-picks #20380, which contains copy changes for the "Enable
Opensea API" => "Display NFT Media" toggle.

Previously, this PR was reverted on #21109 due to some needed changes in
the NFT controllers. [Those changes have now been
made](MetaMask/core#1772).

Changes:
* updated copy changes
* updated snapshots
* lint fix
* updated test

## **Related issues**

Fixes MetaMask/MetaMask-planning#1015

## **Manual testing steps**

1. Go to the "Security & privacy" settings page
2. See the new copy

## **Screenshots/Recordings**

### **Before**

<img width="640" alt="Screenshot 2023-11-07 at 11 49 19"
src="https://github.com/MetaMask/metamask-extension/assets/13814744/723bbd7c-0869-4cae-9b3c-a443db93b66d">

### **After**

<img width="640" alt="Screenshot 2023-11-07 at 11 46 03"
src="https://github.com/MetaMask/metamask-extension/assets/13814744/43565588-f26e-431c-bed2-700598170ef3">


## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **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.

---------

Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
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.

3 participants