Skip to content
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

Version level review #1073

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open

Version level review #1073

wants to merge 63 commits into from

Conversation

x753
Copy link
Contributor

@x753 x753 commented Nov 6, 2024

No description provided.

x753 added 30 commits October 21, 2024 16:57
Move permission logic to PackagePermissionsMixin because PackageDetailView
is a bad place for it
Add more filtering functions, change default visibility to private
Add review_status to PackageVersion
Add reject and approve version actions to Django admin
Add update_visibility method to PackageVersion
Update available_versions to exclude private versions
Update recache latest to only save if latest isn't None
Add VisibilityMixin to PackageListing
Add VisibilityQuerySet to PackageListingQueryset
Add visibility logic to ensure_can_be_viewed_by_user
Add update_visibility method to PackageListing
Use listing.update_visibility in recache_latest
Add migrations to populate visibility field for PackageVersion and
PackageListing
Add visibility filter to PackageListSearchView so searches do not return
packages that are not publicly listed
Fix PackageListing/Version save() which would fail for new instances
Add unavailable_versions property to Package
Update PackageListing Detail and Versions pages to show
unavailability information
Fix latest recaching by finding any active version if the first available version
is None
Ensure package versions are saved before trying to create the listing
Fix visibility by updating only when the related model is saved
Move recache_latest from approve/reject to after update_visibility
Add authentication to package version page so users can't view rejected
versions without proper permissions
Add version review buttons to versions table
Add version reject/approve audit events
Add APIs for rejecting/approving versions
Ensure APIs only return public listings
Update cyberstorm.package.versions and
experimental.frontend.community.packages
return only public_list instances
Add check for None to PackageListing's ensure_can_be_viewed_by_user
Move format_category back inside get_context_data
Filter review queue to moderator_list instead of public_list
Add VisibilityFlagsFactory
Add test for returning only visible packages
Add test for returning only packages with an available version
Add test for returning only visible versions
Add test for ensuring latest is visible if possible
Update webhook audits to display approval, rejection, and warnings for
listings, versions, and packages
Move permission logic to PackagePermissionsMixin because PackageDetailView
is a bad place for it
Add more filtering functions, change default visibility to private
Add review_status to PackageVersion
Add reject and approve version actions to Django admin
Add update_visibility method to PackageVersion
Update available_versions to exclude private versions
Update recache latest to only save if latest isn't None
Add VisibilityMixin to PackageListing
Add VisibilityQuerySet to PackageListingQueryset
Add visibility logic to ensure_can_be_viewed_by_user
Add update_visibility method to PackageListing
Use listing.update_visibility in recache_latest
Add migrations to populate visibility field for PackageVersion and
PackageListing
Add visibility filter to PackageListSearchView so searches do not return
packages that are not publicly listed
Fix PackageListing/Version save() which would fail for new instances
Add unavailable_versions property to Package
Update PackageListing Detail and Versions pages to show
unavailability information
Fix latest recaching by finding any active version if the first available version
is None
Ensure package versions are saved before trying to create the listing
Fix visibility by updating only when the related model is saved
Move recache_latest from approve/reject to after update_visibility
Add authentication to package version page so users can't view rejected
versions without proper permissions
Add version review buttons to versions table
Add version reject/approve audit events
Add APIs for rejecting/approving versions
Ensure APIs only return public listings
x753 added 10 commits November 6, 2024 15:38
Move update_visibility() so it's called whenever something inheriting
VisibilityMixin is saved
Add active() into public_list() so inactive packages are not included in
public_list(), even if they're visible for some reason

Remove all the now-redundant active() checks from queries that use
public_list()
Fix visibility tests by changing review status rather than changing visibility directly
Remove deleting cached unavailable_versions from available_versions
The system is intended to require resolving all three user-specific context
attributes for visibility, so these shorthands go against that.
Ensure inactive models are not visible by checking is_active in the
update_visibility function
Refactors the package management buttons and status cards (deprecated,
rejected, etc) to appear on every detail view page.
Refactor can_be_viewed_by_user from the PackageListing / PackageVersion
classes into is_visible_to_user in the visibility mixin
Allow owners to see their rejected packages by populating the
PackageListByOwnerView with owner_list listings
x753 added 2 commits November 12, 2024 14:40
Turn review_status CharFields into TextFields
Remove redundancy in update_visibility
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 79.93730% with 64 lines in your changes missing coverage. Please review.

Project coverage is 92.40%. Comparing base (e22daf1) to head (8369d36).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
.../thunderstore/repository/models/package_version.py 64.51% 22 Missing ⚠️
...pository/api/experimental/views/package_version.py 50.00% 12 Missing ⚠️
...ango/thunderstore/repository/views/package/list.py 42.85% 12 Missing ⚠️
django/thunderstore/permissions/mixins.py 72.00% 3 Missing and 4 partials ⚠️
...o/thunderstore/repository/admin/package_version.py 64.70% 6 Missing ⚠️
django/thunderstore/repository/views/mixins.py 97.29% 0 Missing and 2 partials ⚠️
...o/thunderstore/repository/views/package/version.py 66.66% 1 Missing and 1 partial ⚠️
django/thunderstore/webhooks/models/audit.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1073      +/-   ##
==========================================
- Coverage   92.94%   92.40%   -0.55%     
==========================================
  Files         315      316       +1     
  Lines        9262     9556     +294     
  Branches      828      887      +59     
==========================================
+ Hits         8609     8830     +221     
- Misses        541      601      +60     
- Partials      112      125      +13     
Flag Coverage Δ
?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Adjust views so latest can be None by supplying a version as context data
@x753 x753 force-pushed the version-level-review branch from c3a2890 to b6567cd Compare November 13, 2024 04:42
x753 added 3 commits November 13, 2024 12:55
Move is_visible_to_user() to version/listing
Also set default visibility to public
Add a rate limit to celery_post, specifically so Discord doesn't drop webhook
messages that come in faster than its limit of 5/2s
Update community aggregates to take into account visibility, and to ignore
cross-community listings
@x753 x753 force-pushed the version-level-review branch from b406fed to b28c8a0 Compare December 12, 2024 13:24
x753 added 7 commits December 17, 2024 15:04
Add system() to VisibilityMixin, which returns all objects regardless of visibility
so that we can always specify the visibility of objects when querying.
Add a test to ensure that models with visibility (currently PackageListing and
PackageVersion) are not called without specifying visibility.
Fix package views 404ing shortly after approval due to the slow
propagation of package.latest
Fix changelog view breaking when latest is None
Create a new python project for flake8 plugins, currently only containing
a plugin to test for unsafe usage of models with visibility
@x753 x753 force-pushed the version-level-review branch from fa9bfb7 to 39acac4 Compare January 14, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants