This commit is contained in:
j3d1 2026-08-27 01:34:34 +02:00
parent f46eff65fd
commit d56784eb8d
8 changed files with 335 additions and 93 deletions

View file

@ -25,9 +25,11 @@ THUMBNAIL_SIZES = (32, 64, 256)
def _accessible_files(request):
# Shared by media_urls and thumbnail_urls: a file is visible if the requester is
# friends-or-self with whatever references it (item, profile picture), or it's their own staged photo.
# friends-or-self with whatever references it (item, profile picture), a member of the group
# that owns the item it's attached to, or it's their own staged photo.
return File.objects.filter(
Q(connected_items__owner__in=request.user.friends_or_self()) |
Q(connected_items__owner_group__in=request.user.member_of_groups.all()) |
Q(profile_picture_users__in=request.user.friends_or_self()) |
Q(staged_by_workflows__owner__in=request.user.user.all())
).distinct()