hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
65 stars 38 forks source link

Viewing comments and threads by deleted addresses should not crash page. #7590

Closed jnaviask closed 2 weeks ago

jnaviask commented 2 weeks ago

Describe the bug

Root cause of #7547 is that deleting an address does not remove its content -- instead, it removes the user_id, profile_id, and verified field on the address. The result is that if a user adds an address, creates a thread or comment, and then deletes it, the UI will crash, as it expects Addresses to have all the associated properties.

Fixing this bug will take place on the UI and will involve two steps. First we note that the current crash described in #7547 comes from the accounts.get() function, which is an abstract interface implemented in each accounts.ts file within each controllers/chain folder (i.e., we have a different "get" interface per folder). As a quick fix, we can simply try/catch the call, rather than having to modify each ecosystem's function directly.

The next step will be taking into account the possible null state of the Account in each case where we use accounts.get() (there are 13 of them, but some may not be necessary to fix immediately). In most of these cases, we end up attempting to display a User or FullUser component -- this component should show [deleted] as address/name with no other metadata in the event that it's provided a null userAddress. In other situations, free free to ask what the appropriate behavior should be.