mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-10-31 22:19:00 +00:00
Merge branch 'main' into production
This commit is contained in:
commit
cc1496cf8f
3 changed files with 15 additions and 18 deletions
|
@ -36,22 +36,19 @@ def get_next_shelf(current_shelf):
|
|||
def active_shelf(context, book):
|
||||
"""check what shelf a user has a book on, if any"""
|
||||
user = context["request"].user
|
||||
return (
|
||||
cache.get_or_set(
|
||||
f"active_shelf-{user.id}-{book.id}",
|
||||
lambda u, b: (
|
||||
models.ShelfBook.objects.filter(
|
||||
shelf__user=u,
|
||||
book__parent_work__editions=b,
|
||||
).first()
|
||||
or False
|
||||
),
|
||||
user,
|
||||
book,
|
||||
timeout=15552000,
|
||||
)
|
||||
or {"book": book}
|
||||
)
|
||||
return cache.get_or_set(
|
||||
f"active_shelf-{user.id}-{book.id}",
|
||||
lambda u, b: (
|
||||
models.ShelfBook.objects.filter(
|
||||
shelf__user=u,
|
||||
book__parent_work__editions=b,
|
||||
).first()
|
||||
or False
|
||||
),
|
||||
user,
|
||||
book,
|
||||
timeout=15552000,
|
||||
) or {"book": book}
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
|
|
|
@ -430,7 +430,7 @@ class ModelFields(TestCase):
|
|||
output = instance.field_to_activity(user.avatar)
|
||||
self.assertIsNotNone(
|
||||
re.match(
|
||||
fr"https:\/\/{DOMAIN}\/.*\.jpg",
|
||||
rf"https:\/\/{DOMAIN}\/.*\.jpg",
|
||||
output.url,
|
||||
)
|
||||
)
|
||||
|
|
|
@ -55,7 +55,7 @@ urlpatterns = [
|
|||
),
|
||||
re_path(
|
||||
"^api/updates/stream/(?P<stream>[a-z]+)/?$",
|
||||
views.get_unread_status_count,
|
||||
views.get_unread_status_string,
|
||||
name="stream-updates",
|
||||
),
|
||||
# authentication
|
||||
|
|
Loading…
Reference in a new issue