mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Block access to follow views
This commit is contained in:
parent
5837c37a32
commit
ec93d1812a
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
""" non-interactive pages """
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models import Q, Count
|
||||
from django.http import Http404
|
||||
|
@ -105,6 +106,9 @@ class Followers(View):
|
|||
if is_api_request(request):
|
||||
return ActivitypubResponse(user.to_followers_activity(**request.GET))
|
||||
|
||||
if user.hide_follows:
|
||||
raise PermissionDenied()
|
||||
|
||||
followers = annotate_if_follows(request.user, user.followers)
|
||||
paginated = Paginator(followers.all(), PAGE_LENGTH)
|
||||
data = {
|
||||
|
@ -125,6 +129,9 @@ class Following(View):
|
|||
if is_api_request(request):
|
||||
return ActivitypubResponse(user.to_following_activity(**request.GET))
|
||||
|
||||
if user.hide_follows:
|
||||
raise PermissionDenied()
|
||||
|
||||
following = annotate_if_follows(request.user, user.following)
|
||||
paginated = Paginator(following.all(), PAGE_LENGTH)
|
||||
data = {
|
||||
|
|
Loading…
Reference in a new issue