{"action":"created","issue":{"url":"https://api.github.com/repos/DemocracyOS/app/issues/464","labels_url":"https://api.github.com/repos/DemocracyOS/app/issues/464/labels{/name}","comments_url":"https://api.github.com/repos/DemocracyOS/app/issues/464/comments","events_url":"https://api.github.com/repos/DemocracyOS/app/issues/464/events","html_url":"https://github.com/DemocracyOS/app/issues/464","id":47198916,"number":464,"title":"Delete user script","user":{"login":"gvilarino","id":2538465,"avatar_url":"https://avatars.githubusercontent.com/u/2538465?v=3","gravatar_id":"","url":"https://api.github.com/users/gvilarino","html_url":"https://github.com/gvilarino","followers_url":"https://api.github.com/users/gvilarino/followers","following_url":"https://api.github.com/users/gvilarino/following{/other_user}","gists_url":"https://api.github.com/users/gvilarino/gists{/gist_id}","starred_url":"https://api.github.com/users/gvilarino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvilarino/subscriptions","organizations_url":"https://api.github.com/users/gvilarino/orgs","repos_url":"https://api.github.com/users/gvilarino/repos","events_url":"https://api.github.com/users/gvilarino/events{/privacy}","received_events_url":"https://api.github.com/users/gvilarino/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/DemocracyOS/app/labels/dev%20love","name":"dev love","color":"d4c5f9"},{"url":"https://api.github.com/repos/DemocracyOS/app/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-10-29T20:24:40Z","updated_at":"2015-01-23T22:19:29Z","closed_at":null,"body":"We need a script for deleting a user from the database. This is required by some implementations.\r\n\r\nWhen deleting a user, we should consider deleting:\r\n- [ ] All user's comments, as well as any replies to them, upvotes and downvotes.\r\n- [ ] All user's votes\r\n- [ ] All user's upvotes/downvotes\r\n- [ ] All user's preferences.\r\n- [ ] The `citizen` itself.\r\n\r\nCheck all models under `lib/models` to understand relationships between different schemas."},"comment":{"url":"https://api.github.com/repos/DemocracyOS/app/issues/comments/71276331","html_url":"https://github.com/DemocracyOS/app/issues/464#issuecomment-71276331","issue_url":"https://api.github.com/repos/DemocracyOS/app/issues/464","id":71276331,"user":{"login":"NazarenoL","id":1238114,"avatar_url":"https://avatars.githubusercontent.com/u/1238114?v=3","gravatar_id":"","url":"https://api.github.com/users/NazarenoL","html_url":"https://github.com/NazarenoL","followers_url":"https://api.github.com/users/NazarenoL/followers","following_url":"https://api.github.com/users/NazarenoL/following{/other_user}","gists_url":"https://api.github.com/users/NazarenoL/gists{/gist_id}","starred_url":"https://api.github.com/users/NazarenoL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NazarenoL/subscriptions","organizations_url":"https://api.github.com/users/NazarenoL/orgs","repos_url":"https://api.github.com/users/NazarenoL/repos","events_url":"https://api.github.com/users/NazarenoL/events{/privacy}","received_events_url":"https://api.github.com/users/NazarenoL/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T22:19:29Z","updated_at":"2015-01-23T22:19:29Z","body":"@gvilarino \r\nI can think of many ways to do this, and a few things to discuss:\r\n1. Do what @slifszyc suggested of explaining that user contributions won't be hard-deleted, but, for example, if you want to delete an user that has been spamming through all the site, it would be ideal to delete everything at once.\r\n2. Develop a function that executes all the queries required to delete the user related contents. \r\n3. The most KISS way would be to define in the database triggers for the foreign keys/relationships (ON DELETE CASCADE...`), and it would ensure consistent data, even if the admin chooses to delete someone directly from the database. \r\n\r\nI would also recommend a few things (That could be implemented both on B or C options):\r\n* I think that a good idea, currently used in plenty of sites, is to instead of deleting the user  all the replies, replace the comment text for an alert/notice that says that it was deleted, while you can still see all the replies."}}