mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-22 05:46:19 +00:00
Merge branch 'main' into production
This commit is contained in:
commit
637600763b
13 changed files with 1358 additions and 1732 deletions
|
@ -45,6 +45,9 @@ EMAIL_HOST_USER=mail@your.domain.here
|
|||
EMAIL_HOST_PASSWORD=emailpassword123
|
||||
EMAIL_USE_TLS=true
|
||||
EMAIL_USE_SSL=false
|
||||
EMAIL_SENDER_NAME=admin
|
||||
# defaults to DOMAIN
|
||||
EMAIL_SENDER_DOMAIN=
|
||||
|
||||
# Query timeouts
|
||||
SEARCH_TIMEOUT=15
|
||||
|
|
|
@ -45,6 +45,9 @@ EMAIL_HOST_USER=mail@your.domain.here
|
|||
EMAIL_HOST_PASSWORD=emailpassword123
|
||||
EMAIL_USE_TLS=true
|
||||
EMAIL_USE_SSL=false
|
||||
EMAIL_SENDER_NAME=admin
|
||||
# defaults to DOMAIN
|
||||
EMAIL_SENDER_DOMAIN=
|
||||
|
||||
# Query timeouts
|
||||
SEARCH_TIMEOUT=15
|
||||
|
|
|
@ -69,7 +69,7 @@ def format_email(email_name, data):
|
|||
def send_email(recipient, subject, html_content, text_content):
|
||||
"""use a task to send the email"""
|
||||
email = EmailMultiAlternatives(
|
||||
subject, text_content, settings.DEFAULT_FROM_EMAIL, [recipient]
|
||||
subject, text_content, settings.EMAIL_SENDER, [recipient]
|
||||
)
|
||||
email.attach_alternative(html_content, "text/html")
|
||||
email.send()
|
||||
|
|
|
@ -24,7 +24,9 @@ EMAIL_HOST_USER = env("EMAIL_HOST_USER")
|
|||
EMAIL_HOST_PASSWORD = env("EMAIL_HOST_PASSWORD")
|
||||
EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", True)
|
||||
EMAIL_USE_SSL = env.bool("EMAIL_USE_SSL", False)
|
||||
DEFAULT_FROM_EMAIL = f"admin@{DOMAIN}"
|
||||
EMAIL_SENDER_NAME = env("EMAIL_SENDER_NAME", "admin")
|
||||
EMAIL_SENDER_DOMAIN = env("EMAIL_SENDER_NAME", DOMAIN)
|
||||
EMAIL_SENDER = f"{EMAIL_SENDER_NAME}@{EMAIL_SENDER_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__)))
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{% load i18n %}
|
||||
{% load cache %}
|
||||
{% load bookwyrm_tags %}
|
||||
|
||||
{# 6 month cache #}
|
||||
{% cache 15552000 suggested_books request.user.id %}
|
||||
{% suggested_books as suggested_books %}
|
||||
<section class="block">
|
||||
<h2 class="title is-4">{% trans "Your Books" %}</h2>
|
||||
|
@ -80,4 +77,3 @@
|
|||
{% endwith %}
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endcache %}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{% load i18n %}
|
||||
{% load cache %}
|
||||
|
||||
{# 6 month cache #}
|
||||
{% cache 15552000 follow_button request.user.id user.id %}
|
||||
{% if request.user == user or not request.user.is_authenticated %}
|
||||
{% elif user in request.user.blocks.all %}
|
||||
{% include 'snippets/block_button.html' with blocks=True %}
|
||||
|
@ -46,4 +43,3 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endcache %}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
{% load bookwyrm_tags %}
|
||||
{% load utilities %}
|
||||
{% load cache %}
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
{# 6 month cache #}
|
||||
{% cache 15552000 shelve_button request.user.id book.id %}
|
||||
|
||||
{% with book.id|uuid as uuid %}
|
||||
{% active_shelf book as active_shelf %}
|
||||
|
@ -35,5 +32,4 @@
|
|||
{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough class="" %}
|
||||
|
||||
{% endwith %}
|
||||
{% endcache %}
|
||||
{% endif %}
|
||||
|
|
|
@ -25,6 +25,13 @@ class GetStartedViews(TestCase):
|
|||
local=True,
|
||||
localname="mouse",
|
||||
)
|
||||
self.local_user = models.User.objects.create_user(
|
||||
"rat@local.com",
|
||||
"rat@rat.rat",
|
||||
"password",
|
||||
local=True,
|
||||
localname="rat",
|
||||
)
|
||||
self.book = models.Edition.objects.create(
|
||||
parent_work=models.Work.objects.create(title="hi"),
|
||||
title="Example Edition",
|
||||
|
@ -121,14 +128,15 @@ class GetStartedViews(TestCase):
|
|||
validate_html(result.render())
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
@patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions")
|
||||
def test_users_view_with_query(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.GetStartedUsers.as_view()
|
||||
request = self.factory.get("?query=rat")
|
||||
request.user = self.local_user
|
||||
|
||||
result = view(request)
|
||||
with patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions") as mock:
|
||||
mock.return_value = models.User.objects.all()
|
||||
result = view(request)
|
||||
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
validate_html(result.render())
|
||||
|
|
|
@ -113,13 +113,16 @@ class GetStartedUsers(View):
|
|||
.filter(
|
||||
similarity__gt=0.5,
|
||||
)
|
||||
.exclude(
|
||||
id=request.user.id,
|
||||
)
|
||||
.order_by("-similarity")[:5]
|
||||
)
|
||||
data = {"no_results": not user_results}
|
||||
|
||||
if user_results.count() < 5:
|
||||
user_results = list(user_results) + suggested_users.get_suggestions(
|
||||
request.user
|
||||
user_results = list(user_results) + list(
|
||||
suggested_users.get_suggestions(request.user)
|
||||
)
|
||||
|
||||
data["suggested_users"] = user_results
|
||||
|
|
|
@ -86,8 +86,10 @@ services:
|
|||
restart: on-failure
|
||||
flower:
|
||||
build: .
|
||||
command: flower -A celerywyrm
|
||||
command: celery -A celerywyrm flower
|
||||
env_file: .env
|
||||
ports:
|
||||
- ${FLOWER_PORT}:${FLOWER_PORT}
|
||||
volumes:
|
||||
- .:/app
|
||||
networks:
|
||||
|
@ -96,8 +98,6 @@ services:
|
|||
- db
|
||||
- redis_broker
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 8888:8888
|
||||
volumes:
|
||||
pgdata:
|
||||
backups:
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"merge": "2.1.1",
|
||||
"postcss": "8.2.10"
|
||||
"postcss": "8.2.13"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
celery==4.4.2
|
||||
celery==5.2.2
|
||||
colorthief==0.2.1
|
||||
Django==3.2.10
|
||||
django-imagekit==4.1.0
|
||||
django-model-utils==4.0.0
|
||||
environs==9.3.4
|
||||
flower==0.9.4
|
||||
flower==1.0.0
|
||||
gunicorn==20.0.4
|
||||
Markdown==3.3.3
|
||||
Pillow>=8.2.0
|
||||
|
|
Loading…
Reference in a new issue