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
127 stars 28 forks source link

Implement a straight forward way to query object visibility #1004

Closed MythicManiac closed 7 months ago

MythicManiac commented 7 months ago

This PR introduces the concept of visibility flags which can be attached to objects and provides a standard interface for querying objects with visibility rules in mind.

The visibility-aware query methods are intentionally kept stupid simple, as the assumption is that the visibility flags will later on be tied to a mechanism which updates them when the underlying object state changes. In other words, the flags which are queried against serve as a sort of cache, while the actual complexities of the visibility rules have to be implemented elsewhere. Ultimately this lets us use far simpler and easier to maintain queries compared to representing all visibility rules on each query site directly.

Some open questions which I deemed out of scope for this PR:

TODO (This PR):

codecov[bot] commented 7 months ago

Codecov Report

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

Comparison is base (37cca3a) 92.82% compared to head (ae1f55d) 92.87%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1004 +/- ## ========================================== + Coverage 92.82% 92.87% +0.04% ========================================== Files 309 312 +3 Lines 8898 8956 +58 Branches 786 794 +8 ========================================== + Hits 8260 8318 +58 Misses 530 530 Partials 108 108 ```

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