Terrastories/terrastories

[Rails] Destroy Users not associated with any Community

rudokemper opened this issue · 0 comments

Currently, Users may only belong to one Community. When a Community is destroyed, then the Users become orphaned, with an undesirable side effect that their username is not available anymore to any future users.

Let's make it so that when a Community is destroyed, any Users associated with them become destroyed as well.

In the future, we may make it possible that a User can belong to multiple Communities; so, to future-proof ourselves, we could take an approach that if a User belongs to 0 communities, then the User is also destroyed.

Acceptance criteria:

  • If there is a new community called Test community with users test-admin, test-user, test-viewer, then
  • When I as a logged in super admin destroy that community, then all three of these users are destroyed as well (insofar as they then belong to 0 communities).