If a user has deleted their account, any chat messages they've made cannot be flagged. This red notification is displayed:
User with id "40c83fc9-4eff-4467-9396-67c125137739" not found.
The console reports:
GET https://habitica.com/api/v3/members/40c83fc9-4eff-4467-9396-67c125137739?userV=12670 404 (Not Found)
The desired behaviour is:
I can take a look into this
The only way I can see getting around the user not seeing the error either on the site or in the console is to have the api not return an error when querying for a user that doesn't exist and instead returning an empty object. I would be hesitant to make this change to the api as that sounds like a big change with a potentially large blast radius.
For this reason, I think that the best solution I can come up with is adding a new api method that allows the client to query if a userId is valid or not allowing the client side to check if the user is valid before trying to get the data (similar to an if (exists) {} else {} pattern).
I'll probably proceed with this idea for the time being but let me know if this doesn't sound like a good idea or if this already exists in the api and I just can't find it.
I don't understand. Can you link to some code snippets about why this would affect more than the flag route?
Oh I see what you mean now. On the client, we look up the member before opening the flag modal. I'm not sure it's actually necessary to do that though. All the needed member info should already be stored on the chat message.
Yeah it looks like it's not needed, like you said everything that's needed is in the message object itself. Removing this call seems the right way to go about it instead of making a new api call.
Most helpful comment
Oh I see what you mean now. On the client, we look up the member before opening the flag modal. I'm not sure it's actually necessary to do that though. All the needed member info should already be stored on the chat message.