plebbit / plebbit-react

A GUI for plebbit
https://plebbitapp.eth.limo
GNU General Public License v2.0
35 stars 6 forks source link

upgrade plebbit-react-hooks and stop using comment.author.address #323

Closed estebanabaroa closed 1 year ago

estebanabaroa commented 1 year ago

In the next version of the hooks (https://github.com/plebbit/plebbit-react-hooks/commit/53226863a4041953f46f920b578c9eac71663572), we have disabled verifying author addresses automatically (synchronously), this will save saveral seconds when downloading a subplebbit feed.

But now it's no longer safe to use comment.author.address directly. Instead you need to do:

import {useComment, useAuthorAddress} from '@plebbit/plebbit-react-hooks'
const comment = useComment({commentCid})
const {authorAddress, shortAuthorAddress} = useAuthorAddress({comment})

You should never display in the UI comment.author.address as it can now be faked, it's no longer verified.

The exception is when linking to an author profile page, /u/${comment.author.address}/c/${comment.cid} should be used, not useAuthorAddress({comment}).authorAddress. If you use useAuthorAddress({comment}).authorAddress in the URL, the /u/ page will sometimes not work.