web3.storage icon indicating copy to clipboard operation
web3.storage copied to clipboard

fix: do not make pins request if the user does not have access #2117

Open alexandrastoica opened this issue 2 years ago • 3 comments

Do not try to fetch pin requests if the user does not have access.

alexandrastoica avatar Nov 24 '22 11:11 alexandrastoica

Website preview 🔗✨

  • 🙂 https://w3s.link/ipfs/bafybeicwsrudmxm5tbjbadm5wkp2otfaomlq2p4dg3deb3poaw7y7taydq
  • ⛅️ https://c91517ea.web3-storage-staging.pages.dev

build log

github-actions[bot] avatar Nov 24 '22 11:11 github-actions[bot]

The server should be verifying this. Is this not the case already?

The user should not reach this view if they don't have access - they won't see the tabs and the table will not be loaded.

alanshaw avatar Nov 30 '22 19:11 alanshaw

@alanshaw thanks for the review, some context:

The server should be verifying this. Is this not the case already?

Yes it is.

The user should not reach this view if they don't have access - they won't see the tabs and the table will not be loaded.

The user does reach the view, more specifically the PinRequestsTable in FileManager is displayed if pin requests count > 0. To get the count, the FileManager uses the usePinRequests hook which tries to fetch the pin requests and throws an error (which is not handled) if the user does not have access. This leads to an error in the console log in prod which I was trying to avoid for the meantime with this PR, while I was working on https://github.com/web3-storage/web3.storage/issues/1947.

I marked this as draft and I'm doing some better improvements here https://github.com/web3-storage/web3.storage/pull/2147, let me know if there's anything that doesn't make sense, or any suggestions :)

alexandrastoica avatar Dec 05 '22 14:12 alexandrastoica