From bdf267dea5fa21755a274a51b3056460de61fdd7 Mon Sep 17 00:00:00 2001
From: Mouse Reeve
Date: Sat, 22 May 2021 20:36:30 -0700
Subject: [PATCH] Refactors block button for query efficiency
---
bookwyrm/templates/preferences/blocks.html | 2 +-
bookwyrm/templates/snippets/block_button.html | 2 +-
bookwyrm/templates/snippets/follow_button.html | 2 +-
.../templates/snippets/status/status_options.html | 2 +-
bookwyrm/templates/snippets/user_options.html | 2 +-
bookwyrm/views/user.py | 11 ++++++++---
6 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/bookwyrm/templates/preferences/blocks.html b/bookwyrm/templates/preferences/blocks.html
index 72d4abd4..24866fa3 100644
--- a/bookwyrm/templates/preferences/blocks.html
+++ b/bookwyrm/templates/preferences/blocks.html
@@ -18,7 +18,7 @@
{% include 'snippets/avatar.html' with user=user %} {{ user.display_name }}
- {% include 'snippets/block_button.html' with user=user %}
+ {% include 'snippets/block_button.html' with user=user blocks=True %}
{% endfor %}
diff --git a/bookwyrm/templates/snippets/block_button.html b/bookwyrm/templates/snippets/block_button.html
index 7e9fcaea..3cad78f6 100644
--- a/bookwyrm/templates/snippets/block_button.html
+++ b/bookwyrm/templates/snippets/block_button.html
@@ -1,5 +1,5 @@
{% load i18n %}
-{% if not user in request.user.blocks.all %}
+{% if not blocks %}