New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create "DeletedUser" model for tracking number of deleted users and deletion reason #1118
Conversation
Thank you for opening PR to Misago! I've did quick skim of your code, and there's little more that needs to be done before this will be mergeable. First, this model will have to be moved to its own file. I know there are other models packed in Next, model will have to be reduced to two fields:
The idea for this model is to hold historical data on user deletions somewhere, so in future we'll be able to display both positive and negative trends on user registrations over period of time. Also we don't want to keep any usernames on this model for GDPR compliance reasons. Lastly, we will need to have migration creating database table for this model, utility module for recording deletions, update codebase to register those events, and add test assertions. |
About migrations update, where can I find it in the documentation? |
Hi, Sorry I've didn't answer this sooner, I was out of the country (continent in fact) so my time for Misago has been severly limited. Misago is using Django framework, and its documentation for database migrations is available here. Long story short: |
Oh, you're referring to Django migrations, I thought you were talking about something else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far this is looking very nice, thank you. 👍
misago/users/models/deleteduser.py
Outdated
) | ||
|
||
class Meta: | ||
get_latest_by = "deleted_on" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use ordering = ['deleted_on']
instead, and set db_index=True
on deleted_on
field.
misago/users/utils.py
Outdated
def record_user_deleted_by_self(): | ||
return DeletedUser.objects.create( | ||
deleted_by=1, | ||
deleted_on=timezone.now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unnecessary to do deleted_on=timezone.now()
in utility functions, because model itself already sets those on creation.
misago/users/utils.py
Outdated
|
||
def record_user_deleted_by_self(): | ||
return DeletedUser.objects.create( | ||
deleted_by=1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace magical numbers with human-understandable names.
This last year I was full of work. Is this still relevant or should be closed? :) |
Hey! In Misago admin panel we are now displaying the graph for new users registrations. I would like to merge this PR eventually so we could also display "User deletions" graph somewhere in the, or on dedicated page in admin panel. Thanks for memory btw. If you have time to spare, could you rebase the PR on latest master to fix conflicts? |
This reverts commit 0451b29.
As i can see, all the requested fixes are done :) |
The migration conflict is now fixed :) |
@metalerk doesn't seem like its fixed. Could please you remove your migration from this PR, rebase against master, and then add new migration? |
@metalerk please make sure you are working with latest Misago code. Migration you've generated is not reflecting that theres already an migration with ID |
@rafalp you're right, I noticed that my master branch is not being synced with upstream. |
* Disable auth-specific features in backend when SSO is enabled * Disable features when SSO is enabled * Add SSO url to core testproject
This reverts commit 0451b29.
This is not a rebase. This PR now includes changes that are not part of it like SSO changes. ;) |
I've pulled this branch locally and rebased it against master. I will ship this in Misago 0.23. Thanks! |
Create "DeletedUser" model for tracking number of deleted users and deletion reason #1086
DeletedUser
model should contain following fields:In future we could use this data to display both positive and negative trends on "forum growth" graph in the admin panel.
NOTE
The
DeletedUser
model was created based onUsernameChange
model.