diff --git a/bookwyrm/emailing.py b/bookwyrm/emailing.py
index 47ac59df5..1804254b0 100644
--- a/bookwyrm/emailing.py
+++ b/bookwyrm/emailing.py
@@ -2,7 +2,7 @@
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
-from bookwyrm import models
+from bookwyrm import models, settings
from bookwyrm.tasks import app
from bookwyrm.settings import DOMAIN
@@ -59,6 +59,8 @@ def format_email(email_name, data):
@app.task
def send_email(recipient, subject, html_content, text_content):
""" use a task to send the email """
- email = EmailMultiAlternatives(subject, text_content, None, [recipient])
+ email = EmailMultiAlternatives(
+ subject, text_content, settings.DEFAULT_FROM_EMAIL, [recipient]
+ )
email.attach_alternative(html_content, "text/html")
email.send()
diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py
index 2c8d25539..c3c1d8a45 100644
--- a/bookwyrm/models/site.py
+++ b/bookwyrm/models/site.py
@@ -83,7 +83,7 @@ class InviteRequest(BookWyrmModel):
def save(self, *args, **kwargs):
""" don't create a request for a registered email """
- if User.objects.filter(email=self.email).exists():
+ if not self.id and User.objects.filter(email=self.email).exists():
raise IntegrityError()
super().save(*args, **kwargs)
diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py
index 1aa7c3bea..0049b80e2 100644
--- a/bookwyrm/settings.py
+++ b/bookwyrm/settings.py
@@ -25,6 +25,7 @@ EMAIL_PORT = env("EMAIL_PORT", 587)
EMAIL_HOST_USER = env("EMAIL_HOST_USER")
EMAIL_HOST_PASSWORD = env("EMAIL_HOST_PASSWORD")
EMAIL_USE_TLS = env("EMAIL_USE_TLS", True)
+DEFAULT_FROM_EMAIL = "admin@{:s}".format(env("DOMAIN"))
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html
index aef8fba1c..95cf86ada 100644
--- a/bookwyrm/templates/book/book.html
+++ b/bookwyrm/templates/book/book.html
@@ -76,24 +76,7 @@
{% endif %}
-
- {% if book.physical_format and not book.pages %}
- {{ book.physical_format | title }}
- {% elif book.physical_format and book.pages %}
- {% blocktrans with format=book.physical_format|title pages=book.pages %}{{ format }}, {{ pages }} pages{% endblocktrans %}
- {% elif book.pages %}
- {% blocktrans with pages=book.pages %}{{ pages }} pages{% endblocktrans %}
- {% endif %}
-
-
- {% if book.published_date and book.publishers %}
- {% blocktrans with date=book.published_date|date:'M jS Y' publisher=book.publishers|join:', ' %}Published {{ date }} by {{ publisher }}.{% endblocktrans %}
- {% elif book.published_date %}
- {% blocktrans with date=book.published_date|date:'M jS Y' %}Published {{ date }}{% endblocktrans %}
- {% elif book.publishers %}
- {% blocktrans with publisher=book.publishers|join:', ' %}Published by {{ publisher }}.{% endblocktrans %}
- {% endif %}
-
+ {% include 'book/publisher_info.html' with book=book %}
{% if book.openlibrary_key %}
{% trans "View on OpenLibrary" %}
diff --git a/bookwyrm/templates/book/edition_filters.html b/bookwyrm/templates/book/edition_filters.html
new file mode 100644
index 000000000..a55b72af0
--- /dev/null
+++ b/bookwyrm/templates/book/edition_filters.html
@@ -0,0 +1,6 @@
+{% extends 'snippets/filters_panel/filters_panel.html' %}
+
+{% block filter_fields %}
+{% include 'book/language_filter.html' %}
+{% include 'book/format_filter.html' %}
+{% endblock %}
diff --git a/bookwyrm/templates/book/editions.html b/bookwyrm/templates/book/editions.html
new file mode 100644
index 000000000..7290cce93
--- /dev/null
+++ b/bookwyrm/templates/book/editions.html
@@ -0,0 +1,36 @@
+{% extends 'layout.html' %}
+{% load i18n %}
+{% load bookwyrm_tags %}
+
+{% block title %}{% blocktrans with book_title=work.title %}Editions of {{ book_title }}{% endblocktrans %}{% endblock %}
+
+{% block content %}
+
+
{% blocktrans with work_path=work.local_path work_title=work.title %}Editions of "{{ work_title }}" {% endblocktrans %}
+
+
+{% include 'book/edition_filters.html' %}
+
+
+ {% for book in editions %}
+
+
+
+
+ {% include 'book/publisher_info.html' with book=book %}
+
+
+ {% include 'snippets/shelve_button/shelve_button.html' with book=book switch_mode=True %}
+
+
+ {% endfor %}
+
+{% endblock %}
diff --git a/bookwyrm/templates/book/format_filter.html b/bookwyrm/templates/book/format_filter.html
new file mode 100644
index 000000000..c722b24f8
--- /dev/null
+++ b/bookwyrm/templates/book/format_filter.html
@@ -0,0 +1,16 @@
+{% extends 'snippets/filters_panel/filter_field.html' %}
+{% load i18n %}
+
+{% block filter %}
+{% trans "Format:" %}
+
+
+ {% trans "Any" %}
+ {% for format in formats %}{% if format %}
+
+ {{ format|title }}
+
+ {% endif %}{% endfor %}
+
+
+{% endblock %}
diff --git a/bookwyrm/templates/book/language_filter.html b/bookwyrm/templates/book/language_filter.html
new file mode 100644
index 000000000..d9051fd81
--- /dev/null
+++ b/bookwyrm/templates/book/language_filter.html
@@ -0,0 +1,16 @@
+{% extends 'snippets/filters_panel/filter_field.html' %}
+{% load i18n %}
+
+{% block filter %}
+{% trans "Language:" %}
+
+
+ {% trans "Any" %}
+ {% for language in languages %}
+
+ {{ language }}
+
+ {% endfor %}
+
+
+{% endblock %}
diff --git a/bookwyrm/templates/book/publisher_info.html b/bookwyrm/templates/book/publisher_info.html
new file mode 100644
index 000000000..0ab354012
--- /dev/null
+++ b/bookwyrm/templates/book/publisher_info.html
@@ -0,0 +1,24 @@
+{% load i18n %}
+
+ {% if book.physical_format and not book.pages %}
+ {{ book.physical_format | title }}
+ {% elif book.physical_format and book.pages %}
+ {% blocktrans with format=book.physical_format|title pages=book.pages %}{{ format }}, {{ pages }} pages{% endblocktrans %}
+ {% elif book.pages %}
+ {% blocktrans with pages=book.pages %}{{ pages }} pages{% endblocktrans %}
+ {% endif %}
+
+{% if book.languages %}
+
+ {% blocktrans with languages=book.languages|join:", " %}{{ languages }} language{% endblocktrans %}
+
+{% endif %}
+
+ {% if book.published_date and book.publishers %}
+ {% blocktrans with date=book.published_date|date:'M jS Y' publisher=book.publishers|join:', ' %}Published {{ date }} by {{ publisher }}.{% endblocktrans %}
+ {% elif book.published_date %}
+ {% blocktrans with date=book.published_date|date:'M jS Y' %}Published {{ date }}{% endblocktrans %}
+ {% elif book.publishers %}
+ {% blocktrans with publisher=book.publishers|join:', ' %}Published by {{ publisher }}.{% endblocktrans %}
+ {% endif %}
+
diff --git a/bookwyrm/templates/directory/community_filter.html b/bookwyrm/templates/directory/community_filter.html
new file mode 100644
index 000000000..bd0ba7785
--- /dev/null
+++ b/bookwyrm/templates/directory/community_filter.html
@@ -0,0 +1,14 @@
+{% extends 'snippets/filters_panel/filter_field.html' %}
+{% load i18n %}
+
+{% block filter %}
+{% trans "Community" %}
+
+
+ {% trans "Local users" %}
+
+
+
+ {% trans "Federated community" %}
+
+{% endblock %}
diff --git a/bookwyrm/templates/directory.html b/bookwyrm/templates/directory/directory.html
similarity index 56%
rename from bookwyrm/templates/directory.html
rename to bookwyrm/templates/directory/directory.html
index 3d47e26bd..7413f67d5 100644
--- a/bookwyrm/templates/directory.html
+++ b/bookwyrm/templates/directory/directory.html
@@ -36,64 +36,7 @@
{% endif %}
-
-
- Filters
-
-
- {% trans "Show filters" as text %}
- {% include 'snippets/toggle/open_button.html' with text=text controls_text="filters" icon="arrow-down" class="is-small" focus="filters" %}
- {% trans "Hide filters" as text %}
- {% include 'snippets/toggle/close_button.html' with text=text controls_text="filters" icon="x" class="is-small" %}
-
-
-
-
- {% if request.GET %}
-
{% trans "Clear filters" %}
- {% endif %}
-
+{% include 'directory/filters.html' %}
{% for user in users %}
diff --git a/bookwyrm/templates/directory/filters.html b/bookwyrm/templates/directory/filters.html
new file mode 100644
index 000000000..c6bbe1575
--- /dev/null
+++ b/bookwyrm/templates/directory/filters.html
@@ -0,0 +1,7 @@
+{% extends 'snippets/filters_panel/filters_panel.html' %}
+
+{% block filter_fields %}
+{% include 'directory/user_type_filter.html' %}
+{% include 'directory/community_filter.html' %}
+{% include 'directory/sort_filter.html' %}
+{% endblock %}
diff --git a/bookwyrm/templates/directory/sort_filter.html b/bookwyrm/templates/directory/sort_filter.html
new file mode 100644
index 000000000..82b561fb7
--- /dev/null
+++ b/bookwyrm/templates/directory/sort_filter.html
@@ -0,0 +1,12 @@
+{% extends 'snippets/filters_panel/filter_field.html' %}
+{% load i18n %}
+
+{% block filter %}
+
{% trans "Order by" %}
+
+
+ {% trans "Suggested" %}
+ {% trans "Recently active" %}
+
+
+{% endblock %}
diff --git a/bookwyrm/templates/directory/user_type_filter.html b/bookwyrm/templates/directory/user_type_filter.html
new file mode 100644
index 000000000..b5961c822
--- /dev/null
+++ b/bookwyrm/templates/directory/user_type_filter.html
@@ -0,0 +1,14 @@
+{% extends 'snippets/filters_panel/filter_field.html' %}
+{% load i18n %}
+
+{% block filter %}
+
{% trans "User type" %}
+
+
+ {% trans "BookWyrm users" %}
+
+
+
+ {% trans "All known users" %}
+
+{% endblock %}
diff --git a/bookwyrm/templates/editions.html b/bookwyrm/templates/editions.html
deleted file mode 100644
index f83197579..000000000
--- a/bookwyrm/templates/editions.html
+++ /dev/null
@@ -1,14 +0,0 @@
-{% extends 'layout.html' %}
-{% load i18n %}
-{% load bookwyrm_tags %}
-
-{% block title %}{% blocktrans with book_title=work.title %}Editions of {{ book_title }}{% endblocktrans %}{% endblock %}
-
-{% block content %}
-
-
{% blocktrans with work_path=work.local_path work_title=work.title %}Editions of "{{ work_title }}" {% endblocktrans %}
-
- {% include 'snippets/book_tiles.html' with books=editions %}
-
-{% endblock %}
-
diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html
index 4f6573582..f0f04b846 100644
--- a/bookwyrm/templates/layout.html
+++ b/bookwyrm/templates/layout.html
@@ -107,7 +107,7 @@
{% trans 'Settings' %}
- {% if perms.bookwyrm.create_invites or perms.bookwyrm.edit_instance_settings%}
+ {% if perms.bookwyrm.create_invites or perms.moderate_users %}
{% endif %}
{% if perms.bookwyrm.create_invites %}
@@ -117,9 +117,9 @@
{% endif %}
- {% if perms.bookwyrm.edit_instance_settings %}
+ {% if perms.bookwyrm.moderate_users %}
-
+
{% trans 'Admin' %}
diff --git a/bookwyrm/templates/snippets/filters_panel/filter_field.html b/bookwyrm/templates/snippets/filters_panel/filter_field.html
new file mode 100644
index 000000000..0a8daaa11
--- /dev/null
+++ b/bookwyrm/templates/snippets/filters_panel/filter_field.html
@@ -0,0 +1,6 @@
+
+
+ {% block filter %}
+ {% endblock %}
+
+
diff --git a/bookwyrm/templates/snippets/filters_panel/filters_panel.html b/bookwyrm/templates/snippets/filters_panel/filters_panel.html
new file mode 100644
index 000000000..185f5bc48
--- /dev/null
+++ b/bookwyrm/templates/snippets/filters_panel/filters_panel.html
@@ -0,0 +1,25 @@
+{% load i18n %}
+
+
+ Filters
+
+
+ {% trans "Show filters" as text %}
+ {% include 'snippets/toggle/open_button.html' with text=text controls_text="filters" icon="arrow-down" class="is-small" focus="filters" %}
+ {% trans "Hide filters" as text %}
+ {% include 'snippets/toggle/close_button.html' with text=text controls_text="filters" icon="x" class="is-small" %}
+
+
+
+
+
+ {% if request.GET %}
+
{% trans "Clear filters" %}
+ {% endif %}
+
diff --git a/bookwyrm/templates/snippets/pagination.html b/bookwyrm/templates/snippets/pagination.html
index 2ac105577..17418e8c7 100644
--- a/bookwyrm/templates/snippets/pagination.html
+++ b/bookwyrm/templates/snippets/pagination.html
@@ -2,7 +2,7 @@