emblacken files
Wouldn't it be great if I just remembered to run Black before every commit?
This commit is contained in:
@ -7,6 +7,7 @@ from .base_model import BookWyrmModel
|
||||
from . import fields
|
||||
from .relationship import UserBlocks
|
||||
|
||||
|
||||
class Group(BookWyrmModel):
|
||||
"""A group of users"""
|
||||
|
||||
@ -36,6 +37,7 @@ class Group(BookWyrmModel):
|
||||
|
||||
return queryset.exclude(~Q(memberships__user=viewer), privacy="direct")
|
||||
|
||||
|
||||
class GroupMember(models.Model):
|
||||
"""Users who are members of a group"""
|
||||
|
||||
|
@ -79,7 +79,9 @@ class List(OrderedCollectionMixin, BookWyrmModel):
|
||||
|
||||
return queryset.exclude(
|
||||
~Q( # user isn't following and it isn't their own status and they are not a group member
|
||||
Q(user__followers=viewer) | Q(user=viewer) | Q(group__memberships__user=viewer)
|
||||
Q(user__followers=viewer)
|
||||
| Q(user=viewer)
|
||||
| Q(group__memberships__user=viewer)
|
||||
),
|
||||
privacy="followers", # and the status (of the list) is followers only
|
||||
)
|
||||
@ -89,10 +91,10 @@ class List(OrderedCollectionMixin, BookWyrmModel):
|
||||
"""Override filter for "direct" privacy level to allow group members to see the existence of group lists"""
|
||||
|
||||
return queryset.exclude(
|
||||
~Q( # user not self and not in the group if this is a group list
|
||||
Q(user=viewer) | Q(group__memberships__user=viewer)
|
||||
),
|
||||
privacy="direct"
|
||||
~Q( # user not self and not in the group if this is a group list
|
||||
Q(user=viewer) | Q(group__memberships__user=viewer)
|
||||
),
|
||||
privacy="direct",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
Reference in New Issue
Block a user