Skip to content

Commit

Permalink
Merge branch 'main' into export-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mouse-reeve authored Feb 3, 2024
2 parents 9c5f6c5 + 45cc3dc commit 5f2f321
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,7 @@ CSP_ADDITIONAL_HOSTS=

# Increase if users are having trouble uploading BookWyrm export files.
# Default value is 100MB
DATA_UPLOAD_MAX_MEMORY_SIZE=104857600
DATA_UPLOAD_MAX_MEMORY_SIZE=104857600

# Time before being logged out (in seconds)
# SESSION_COOKIE_AGE=2592000 # current default: 30 days
3 changes: 3 additions & 0 deletions bookwyrm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

PAGE_LENGTH = env.int("PAGE_LENGTH", 15)
DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")
# TODO: extend maximum age to 1 year once termination of active sessions
# is implemented (see bookwyrm-social#2278, bookwyrm-social#3082).
SESSION_COOKIE_AGE = env.int("SESSION_COOKIE_AGE", 3600 * 24 * 30) # 1 month

JS_CACHE = "8a89cad7"

Expand Down
2 changes: 1 addition & 1 deletion bookwyrm/templates/feed/feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h1 class="title">
</section>
{% endif %}

{% if annual_summary_year and tab.key == 'home' %}
{% if annual_summary_year and tab.key == 'home' and has_summary_read_throughs %}
<section class="block is-hidden" data-hide="hide_annual_summary_{{ annual_summary_year }}">
{% include 'feed/summary_card.html' with year=annual_summary_year %}
<hr>
Expand Down
15 changes: 15 additions & 0 deletions bookwyrm/views/feed.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" non-interactive pages """
from datetime import date
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.db.models import Q
Expand Down Expand Up @@ -52,6 +53,19 @@ def get(self, request, tab, filters_applied=False):

suggestions = suggested_users.get_suggestions(request.user)

cutoff = (
date(get_annual_summary_year(), 12, 31)
if get_annual_summary_year()
else None
)
readthroughs = (
models.ReadThrough.objects.filter(
user=request.user, finish_date__lte=cutoff
)
if get_annual_summary_year()
else []
)

data = {
**feed_page_data(request.user),
**{
Expand All @@ -66,6 +80,7 @@ def get(self, request, tab, filters_applied=False):
"path": f"/{tab['key']}",
"annual_summary_year": get_annual_summary_year(),
"has_tour": True,
"has_summary_read_throughs": len(readthroughs),
},
}
return TemplateResponse(request, "feed/feed.html", data)
Expand Down
3 changes: 3 additions & 0 deletions redis.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ bind 127.0.0.1 ::1
protected-mode yes
port 6379

auto-aof-rewrite-percentage 50
auto-aof-rewrite-min-size 128mb

rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command DEBUG ""
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.9.0
aiohttp==3.9.2
bleach==5.0.1
celery==5.2.7
colorthief==0.2.1
Expand Down

0 comments on commit 5f2f321

Please sign in to comment.