Skip to content

Commit a211001

Browse files
committed
Added docstrings for update_visibility()
1 parent b6196a3 commit a211001

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

django/thunderstore/community/models/package_listing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,13 @@ def is_visible_to_user(self, user: Optional[UserType]) -> bool:
397397

398398
@transaction.atomic
399399
def update_visibility(self):
400+
"""
401+
Updates the package listing's visibility based on whether its package is active, its review status,
402+
and the visibility of its active versions.
403+
404+
By default, listings are visible to everyone (for now). Rejected listings aren't publicly visible,
405+
and listings with inactive packages aren't visible at all.
406+
"""
400407
self.visibility.public_detail = True
401408
self.visibility.public_list = True
402409
self.visibility.owner_detail = True

django/thunderstore/repository/models/package_version.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,13 @@ def is_visible_to_user(self, user: UserType) -> bool:
431431

432432
@transaction.atomic
433433
def update_visibility(self):
434+
"""
435+
Updates the version's visibility based on whether it or its package is active and its review status.
436+
This may also change the visibility of related listings, so it calls update_visibility() on them.
437+
438+
By default, versions are visible to everyone (for now). Rejected versions aren't publicly visible,
439+
and inactive versions or versions with inactive packages aren't visible at all.
440+
"""
434441
self.visibility.public_detail = True
435442
self.visibility.public_list = True
436443
self.visibility.owner_detail = True

0 commit comments

Comments
 (0)