Fixes#986
- Adds a new notification preference to the existing `Preferences` model
and associated form.
- Adds data migration to populate the new preference
- Adds a new test and modifies several others to reflect the new
preference and its behavior
Note the ability to actually send notification will be added
post-launch. If the need comes up in the meantime, it would be
straightforward to manually trigger a notification to opted-in users.
### Manual testing
UI
<img width="553" alt="Screenshot 2024-11-06 at 9 52 52 AM"
src="https://github.com/user-attachments/assets/e7d8ef21-8e21-4fe4-81b0-2e401d10203f">
Data
<img width="478" alt="Screenshot 2024-11-06 at 10 35 11 AM"
src="https://github.com/user-attachments/assets/44237931-05dd-4c38-972f-057321c93945">
---------
Co-authored-by: Greg Kaleka <gkaleka@energy-solution.com>
This also hides the pop up notifications after 6 seconds
For review, a review and merge of #1311 on which this is built would
make this easier to review.
- Add file type validator
- Apply validator to user image
- Save validator class to variable
- Add image validator to news image model field
- Add file size validator
- Enable file size validator on news and user model image fields
- Fix test
from key
Mark users as claimed when they reset password from profile page
Add method to claim user, and use that method instead
Add docs on unclaimed user accounts
The original code incorrectly assumed that the User object would
always have a first and last name and that they would be unique across
users.
This changes the filename to be "profile-{user.pk}-{10 random
characters}.png" which should ensure there is no overwritting happening.
Part of #343. The news' notifications module was also changed to the user
preferences is honored when sending news emails.
Also exclude migrations from the black check.
- Add a display_name field to the User model
- Implement get_display_name property to return display_name, full name, or a single name, depending on the available information
- Add tests for the get_display_name property
Reduces the duplicates by a lot. Some still remain, mostly related to differences in spelling (Jeff versus Jeffrey) or differences in diacritical marks.
Default to `True` because the only conditions in which these would be False is on import of author/maintainer data for the Libraries from GitHub. After the initial launch, these fields won't be used with nearly the frequency.