1
0
Fork 0

Merge pull request #1534 from bookwyrm-social/followers-display

Fixes privacy filters for followers-only replies
This commit is contained in:
Mouse Reeve 2021-10-15 13:38:42 -07:00 committed by GitHub
commit eac1ed3484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 5 deletions

View file

@ -224,6 +224,16 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
~Q(Q(user=viewer) | Q(mention_users=viewer)), privacy="direct"
)
@classmethod
def followers_filter(cls, queryset, viewer):
"""Override-able filter for "followers" privacy level"""
return queryset.exclude(
~Q( # not yourself, a follower, or someone who is tagged
Q(user__followers=viewer) | Q(user=viewer) | Q(mention_users=viewer)
),
privacy="followers", # and the status is followers only
)
class GeneratedNote(Status):
"""these are app-generated messages about user activity"""