forked from mirrors/bookwyrm
Removes filter for checking for follow requests
This commit is contained in:
parent
3de8ae00ae
commit
f5eb5f982a
3 changed files with 1 additions and 33 deletions
|
@ -1,6 +1,5 @@
|
|||
{% load i18n %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% if request.user|follow_request_exists:user %}
|
||||
{% if request.user in user.follow_requests.all %}
|
||||
<div class="field is-grouped">
|
||||
<form action="/accept-follow-request/" method="POST">
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -79,19 +79,6 @@ def get_user_boosted(user, status):
|
|||
return user.id in status.boosters.all().values_list("user", flat=True)
|
||||
|
||||
|
||||
@register.filter(name="follow_request_exists")
|
||||
def follow_request_exists(user, requester):
|
||||
"""see if there is a pending follow request for a user"""
|
||||
try:
|
||||
models.UserFollowRequest.objects.filter(
|
||||
user_subject=requester,
|
||||
user_object=user,
|
||||
).get()
|
||||
return True
|
||||
except models.UserFollowRequest.DoesNotExist:
|
||||
return False
|
||||
|
||||
|
||||
@register.filter(name="boosted_status")
|
||||
def get_boosted(boost):
|
||||
"""load a boosted status. have to do this or it wont get foregin keys"""
|
||||
|
|
|
@ -113,24 +113,6 @@ class TemplateTags(TestCase):
|
|||
models.Boost.objects.create(user=self.user, boosted_status=status)
|
||||
self.assertTrue(bookwyrm_tags.get_user_boosted(self.user, status))
|
||||
|
||||
def test_follow_request_exists(self, _):
|
||||
"""does a user want to follow"""
|
||||
self.assertFalse(
|
||||
bookwyrm_tags.follow_request_exists(self.user, self.remote_user)
|
||||
)
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
models.UserFollowRequest.objects.create(
|
||||
user_subject=self.user, user_object=self.remote_user
|
||||
)
|
||||
|
||||
self.assertFalse(
|
||||
bookwyrm_tags.follow_request_exists(self.user, self.remote_user)
|
||||
)
|
||||
self.assertTrue(
|
||||
bookwyrm_tags.follow_request_exists(self.remote_user, self.user)
|
||||
)
|
||||
|
||||
def test_get_boosted(self, _):
|
||||
"""load a boosted status"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
|
|
Loading…
Reference in a new issue