thunderstore-io / Thunderstore

Thunderstore is a mod database and API for downloading mods. Thunderstore Discord: https://discord.thunderstore.io/
https://thunderstore.io/
GNU Affero General Public License v3.0
134 stars 27 forks source link

Cyberstorm: show deprecated package dependencies #988

Closed anttimaki closed 9 months ago

anttimaki commented 9 months ago

Add PackageVersion.is_effectively_active

Helper method checks that both the PackageVersion and the related Package are active. This is acts as a pair for the existing Package.is_effectively_active helper.

Refs TS-2013

Cyberstorm API: include deactived dependencies for package listing

Even if a dependency is deactived, it's still a dependency of the package, which might not work without it. To avoid misleading information on the website, include deactived dependencies too.

PackageVersion is considered deactived if the parent Package is deactived, even if the specific version would be active.

Annotating the "effective active status" to the QuerySet was considered, but since the related package is prefetched for other purposes anyway, it seemed like an unnecessary step.

Refs TS-2013

Cyberstorm API: censor deactived package dependencies

The reason why a package has been deactivated may be an obnoxious icon or description text, so don't send those to clients.

Method serializers are used instead of annotations, since especially for the icon field the annotation isn't straightforward: the ImageField can't be directly attached to the object, and parsing the absolute URL correctly from the path representation stored in the database is error-prone.

Refs TS-2013

anttimaki commented 9 months ago

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (4688b36) 93.04% compared to head (6e1b65d) 93.05%. Report is 5 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #988 +/- ## ======================================= Coverage 93.04% 93.05% ======================================= Files 296 296 Lines 8660 8669 +9 Branches 770 770 ======================================= + Hits 8058 8067 +9 Misses 498 498 Partials 104 104 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

anttimaki commented 9 months ago

The issues mentioned above were discussed in Discord and it was decided that neither is a show stopper right now.