Merge branch 'main' into pylint-update
This commit is contained in:
commit
cf3157a3b5
35 changed files with 900 additions and 522 deletions
|
@ -77,7 +77,7 @@ def privacy_filter(viewer, queryset, privacy_levels=None, following_only=False):
|
|||
elif "followers" in privacy_levels:
|
||||
queryset = queryset.exclude(
|
||||
~Q( # user isn't following and it isn't their own status
|
||||
Q(user__in=viewer.following.all()) | Q(user=viewer)
|
||||
Q(user__followers=viewer) | Q(user=viewer)
|
||||
),
|
||||
privacy="followers", # and the status is followers only
|
||||
)
|
||||
|
|
|
@ -36,6 +36,8 @@ class Lists(View):
|
|||
item_count=Count("listitem", filter=Q(listitem__approved=True))
|
||||
)
|
||||
.filter(item_count__gt=0)
|
||||
.select_related("user")
|
||||
.prefetch_related("listitem_set")
|
||||
.order_by("-updated_date")
|
||||
.distinct()
|
||||
)
|
||||
|
|
|
@ -16,6 +16,10 @@ from bookwyrm.settings import DOMAIN
|
|||
class Register(View):
|
||||
"""register a user"""
|
||||
|
||||
def get(self, request): # pylint: disable=unused-argument
|
||||
"""whether or not you're logged in, just go to the home view"""
|
||||
return redirect("/")
|
||||
|
||||
@sensitive_variables("password")
|
||||
@method_decorator(sensitive_post_parameters("password"))
|
||||
def post(self, request):
|
||||
|
|
|
@ -59,8 +59,18 @@ class User(View):
|
|||
request.user,
|
||||
user.status_set.select_subclasses(),
|
||||
)
|
||||
.select_related("reply_parent")
|
||||
.prefetch_related("mention_books", "mention_users")
|
||||
.select_related(
|
||||
"user",
|
||||
"reply_parent",
|
||||
"review__book",
|
||||
"comment__book",
|
||||
"quotation__book",
|
||||
)
|
||||
.prefetch_related(
|
||||
"mention_books",
|
||||
"mention_users",
|
||||
"attachments",
|
||||
)
|
||||
)
|
||||
|
||||
paginated = Paginator(activities, PAGE_LENGTH)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue