community-platform
community-platform copied to clipboard
[bug] deleted user still appear on the map
Describe the bug Deleted users still appears on the map.
To Reproduce Steps to reproduce the behavior:
- Check the pin of Precious Plastic Landcaster on the map (see screenshot)
- Click on user profile
- See error : user not found
Expected behavior Map pin should be deleted with user.
Screenshots

Not sure if this user was actually deleted. Might be a bug since it looks like its back now

I was able to reproduce this issue on localhost. The problem is that when a user is deleted there is nothing that marks the pin as deleted or removes the doc.
I have three questions:
- The mappin document should be removed or should be updated with
_deleted: true? I check the user and is deleted by removing the document. - Should be removed in
onDeletehook (similar to this) or should be something we call where the user is deleted? - Is there something else that should be removed when a user is deleted?
Also, a script must be made to remove all the pins where the user doesn't exist anymore.
I would like to take this one so I can learn some firebase.
Thanks for looking into the old issues. This is still a very useful one the fix! :) Tagging @chrismclarke in since he would have a better understanding on how to implement this.
Ok whilst waiting for Chris I got an answer on 1 and 2 @Ulian
- Lets start with
_deleted: truefor now. - ....
- I asked in our discord. Like the reply below.
So what can be removed:
- Profile, email, personal data etc
- Map Pin
What should stay
- How-to's uploaded
- Research started
- Comments made
⭐️ Ideally as a bonus we show that the account was deleted. But can imagine this is to much for this issue.
Sorry this fell off my radar, thanks for weighing in on the discussion @Ulian and @davehakkens
A couple points from my side
The` mappin document should be removed or should be updated with _deleted: true? I check the user and is deleted by removing the document.
For now I think this is the best approach. The problem we have is that users keep a cache of old documents in their local indexeddb and so if we simply remove the document there is no way to inform users that it should no longer exist. This isn't an issue for user profiles because they are not cached in the same way (we never need to display all users on a page so don't cache). By marking as _deleted:true (and removing all other data from it if wanted) the document still receives an update and so will store in the cache that way. We should then make sure these deleted docs are filtered out from the display
The alternative would be to add an aggregation to summarise all the map pins, and we could use that aggregation to cross-check local indexeddb to delete - however that would be quite a chunk of work and possibly not worth the effort as we're looking into larger changes such as moving towards server-side-rendering which wouldn't use the same indexeddb cache.
Should be removed in onDelete hook (similar to this) or should be something we call where the user is deleted? Is there something else that should be removed when a user is deleted?
Sounds good to me, I think using hooks to trigger deletions on the backend server is probably more reliable than manually calling from the frontend code. The challenge here is testing those triggers when running locally - this is one of the reasons we have the emulator setup working (not sure if you have used in the past, info in docs here or let me know if you need any help)
Also, a script must be made to remove all the pins where the user doesn't exist anymore.
This might have to come as a second stage as I don't think we have great tooling in place to handle migration of legacy data. Although if you did want to test you could look at drafting a firebase function that does the work using a HTTP endpoint or random db trigger, and I can support to get integrated into a wider releases system
:tada: This issue has been resolved in version 1.84.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: