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_HOST_PASSWORD=emailpassword123
|
||||||
EMAIL_USE_TLS=true
|
EMAIL_USE_TLS=true
|
||||||
EMAIL_USE_SSL=false
|
EMAIL_USE_SSL=false
|
||||||
|
EMAIL_SENDER_NAME=admin
|
||||||
|
# defaults to DOMAIN
|
||||||
|
EMAIL_SENDER_DOMAIN=
|
||||||
|
|
||||||
# Query timeouts
|
# Query timeouts
|
||||||
SEARCH_TIMEOUT=15
|
SEARCH_TIMEOUT=15
|
||||||
|
|
|
@ -45,6 +45,9 @@ EMAIL_HOST_USER=mail@your.domain.here
|
||||||
EMAIL_HOST_PASSWORD=emailpassword123
|
EMAIL_HOST_PASSWORD=emailpassword123
|
||||||
EMAIL_USE_TLS=true
|
EMAIL_USE_TLS=true
|
||||||
EMAIL_USE_SSL=false
|
EMAIL_USE_SSL=false
|
||||||
|
EMAIL_SENDER_NAME=admin
|
||||||
|
# defaults to DOMAIN
|
||||||
|
EMAIL_SENDER_DOMAIN=
|
||||||
|
|
||||||
# Query timeouts
|
# Query timeouts
|
||||||
SEARCH_TIMEOUT=15
|
SEARCH_TIMEOUT=15
|
||||||
|
|
|
@ -69,7 +69,7 @@ def format_email(email_name, data):
|
||||||
def send_email(recipient, subject, html_content, text_content):
|
def send_email(recipient, subject, html_content, text_content):
|
||||||
"""use a task to send the email"""
|
"""use a task to send the email"""
|
||||||
email = EmailMultiAlternatives(
|
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.attach_alternative(html_content, "text/html")
|
||||||
email.send()
|
email.send()
|
||||||
|
|
|
@ -24,7 +24,9 @@ EMAIL_HOST_USER = env("EMAIL_HOST_USER")
|
||||||
EMAIL_HOST_PASSWORD = env("EMAIL_HOST_PASSWORD")
|
EMAIL_HOST_PASSWORD = env("EMAIL_HOST_PASSWORD")
|
||||||
EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", True)
|
EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", True)
|
||||||
EMAIL_USE_SSL = env.bool("EMAIL_USE_SSL", False)
|
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, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load cache %}
|
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
|
|
||||||
{# 6 month cache #}
|
|
||||||
{% cache 15552000 suggested_books request.user.id %}
|
|
||||||
{% suggested_books as suggested_books %}
|
{% suggested_books as suggested_books %}
|
||||||
<section class="block">
|
<section class="block">
|
||||||
<h2 class="title is-4">{% trans "Your Books" %}</h2>
|
<h2 class="title is-4">{% trans "Your Books" %}</h2>
|
||||||
|
@ -80,4 +77,3 @@
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
{% endcache %}
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
{% load i18n %}
|
{% 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 %}
|
{% if request.user == user or not request.user.is_authenticated %}
|
||||||
{% elif user in request.user.blocks.all %}
|
{% elif user in request.user.blocks.all %}
|
||||||
{% include 'snippets/block_button.html' with blocks=True %}
|
{% include 'snippets/block_button.html' with blocks=True %}
|
||||||
|
@ -46,4 +43,3 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endcache %}
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
{% load utilities %}
|
{% load utilities %}
|
||||||
{% load cache %}
|
|
||||||
|
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
{# 6 month cache #}
|
|
||||||
{% cache 15552000 shelve_button request.user.id book.id %}
|
|
||||||
|
|
||||||
{% with book.id|uuid as uuid %}
|
{% with book.id|uuid as uuid %}
|
||||||
{% active_shelf book as active_shelf %}
|
{% 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="" %}
|
{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough class="" %}
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endcache %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -25,6 +25,13 @@ class GetStartedViews(TestCase):
|
||||||
local=True,
|
local=True,
|
||||||
localname="mouse",
|
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(
|
self.book = models.Edition.objects.create(
|
||||||
parent_work=models.Work.objects.create(title="hi"),
|
parent_work=models.Work.objects.create(title="hi"),
|
||||||
title="Example Edition",
|
title="Example Edition",
|
||||||
|
@ -121,14 +128,15 @@ class GetStartedViews(TestCase):
|
||||||
validate_html(result.render())
|
validate_html(result.render())
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
@patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions")
|
|
||||||
def test_users_view_with_query(self, *_):
|
def test_users_view_with_query(self, *_):
|
||||||
"""there are so many views, this just makes sure it LOADS"""
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
view = views.GetStartedUsers.as_view()
|
view = views.GetStartedUsers.as_view()
|
||||||
request = self.factory.get("?query=rat")
|
request = self.factory.get("?query=rat")
|
||||||
request.user = self.local_user
|
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)
|
self.assertIsInstance(result, TemplateResponse)
|
||||||
validate_html(result.render())
|
validate_html(result.render())
|
||||||
|
|
|
@ -113,13 +113,16 @@ class GetStartedUsers(View):
|
||||||
.filter(
|
.filter(
|
||||||
similarity__gt=0.5,
|
similarity__gt=0.5,
|
||||||
)
|
)
|
||||||
|
.exclude(
|
||||||
|
id=request.user.id,
|
||||||
|
)
|
||||||
.order_by("-similarity")[:5]
|
.order_by("-similarity")[:5]
|
||||||
)
|
)
|
||||||
data = {"no_results": not user_results}
|
data = {"no_results": not user_results}
|
||||||
|
|
||||||
if user_results.count() < 5:
|
if user_results.count() < 5:
|
||||||
user_results = list(user_results) + suggested_users.get_suggestions(
|
user_results = list(user_results) + list(
|
||||||
request.user
|
suggested_users.get_suggestions(request.user)
|
||||||
)
|
)
|
||||||
|
|
||||||
data["suggested_users"] = user_results
|
data["suggested_users"] = user_results
|
||||||
|
|
|
@ -86,8 +86,10 @@ services:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
flower:
|
flower:
|
||||||
build: .
|
build: .
|
||||||
command: flower -A celerywyrm
|
command: celery -A celerywyrm flower
|
||||||
env_file: .env
|
env_file: .env
|
||||||
|
ports:
|
||||||
|
- ${FLOWER_PORT}:${FLOWER_PORT}
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
networks:
|
networks:
|
||||||
|
@ -96,8 +98,6 @@ services:
|
||||||
- db
|
- db
|
||||||
- redis_broker
|
- redis_broker
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
ports:
|
|
||||||
- 8888:8888
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
backups:
|
backups:
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"merge": "2.1.1",
|
"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
|
colorthief==0.2.1
|
||||||
Django==3.2.10
|
Django==3.2.10
|
||||||
django-imagekit==4.1.0
|
django-imagekit==4.1.0
|
||||||
django-model-utils==4.0.0
|
django-model-utils==4.0.0
|
||||||
environs==9.3.4
|
environs==9.3.4
|
||||||
flower==0.9.4
|
flower==0.9.4
|
||||||
|
flower==1.0.0
|
||||||
gunicorn==20.0.4
|
gunicorn==20.0.4
|
||||||
Markdown==3.3.3
|
Markdown==3.3.3
|
||||||
Pillow>=8.2.0
|
Pillow>=8.2.0
|
||||||
|
|
Loading…
Add table
Reference in a new issue