diff --git a/bookwyrm/templates/snippets/follow_request_buttons.html b/bookwyrm/templates/snippets/follow_request_buttons.html index 42e691538..d91018027 100644 --- a/bookwyrm/templates/snippets/follow_request_buttons.html +++ b/bookwyrm/templates/snippets/follow_request_buttons.html @@ -1,6 +1,5 @@ {% load i18n %} -{% load bookwyrm_tags %} -{% if request.user|follow_request_exists:user %} +{% if request.user in user.follow_requests.all %}
{% csrf_token %} diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index fa2998e6f..81019fe54 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -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""" diff --git a/bookwyrm/tests/test_templatetags.py b/bookwyrm/tests/test_templatetags.py index df4df6713..3e2ecf37e 100644 --- a/bookwyrm/tests/test_templatetags.py +++ b/bookwyrm/tests/test_templatetags.py @@ -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"):