forked from mirrors/bookwyrm
Merge pull request #1882 from bookwyrm-social/fix-urls
Bring prod and main into sync on urls
This commit is contained in:
commit
65e4e6418e
4 changed files with 31 additions and 24 deletions
|
@ -36,22 +36,19 @@ def get_next_shelf(current_shelf):
|
||||||
def active_shelf(context, book):
|
def active_shelf(context, book):
|
||||||
"""check what shelf a user has a book on, if any"""
|
"""check what shelf a user has a book on, if any"""
|
||||||
user = context["request"].user
|
user = context["request"].user
|
||||||
return (
|
return cache.get_or_set(
|
||||||
cache.get_or_set(
|
f"active_shelf-{user.id}-{book.id}",
|
||||||
f"active_shelf-{user.id}-{book.id}",
|
lambda u, b: (
|
||||||
lambda u, b: (
|
models.ShelfBook.objects.filter(
|
||||||
models.ShelfBook.objects.filter(
|
shelf__user=u,
|
||||||
shelf__user=u,
|
book__parent_work__editions=b,
|
||||||
book__parent_work__editions=b,
|
).first()
|
||||||
).first()
|
or False
|
||||||
or False
|
),
|
||||||
),
|
user,
|
||||||
user,
|
book,
|
||||||
book,
|
timeout=15552000,
|
||||||
timeout=15552000,
|
) or {"book": book}
|
||||||
)
|
|
||||||
or {"book": book}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=False)
|
@register.simple_tag(takes_context=False)
|
||||||
|
|
|
@ -430,7 +430,7 @@ class ModelFields(TestCase):
|
||||||
output = instance.field_to_activity(user.avatar)
|
output = instance.field_to_activity(user.avatar)
|
||||||
self.assertIsNotNone(
|
self.assertIsNotNone(
|
||||||
re.match(
|
re.match(
|
||||||
fr"https:\/\/{DOMAIN}\/.*\.jpg",
|
rf"https:\/\/{DOMAIN}\/.*\.jpg",
|
||||||
output.url,
|
output.url,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -34,9 +34,11 @@ urlpatterns = [
|
||||||
TemplateView.as_view(template_name="robots.txt", content_type="text/plain"),
|
TemplateView.as_view(template_name="robots.txt", content_type="text/plain"),
|
||||||
),
|
),
|
||||||
# federation endpoints
|
# federation endpoints
|
||||||
re_path(r"^inbox/?$", views.Inbox.as_view()),
|
re_path(r"^inbox/?$", views.Inbox.as_view(), name="inbox"),
|
||||||
re_path(rf"{LOCAL_USER_PATH}/inbox/?$", views.Inbox.as_view()),
|
re_path(rf"{LOCAL_USER_PATH}/inbox/?$", views.Inbox.as_view(), name="user_inbox"),
|
||||||
re_path(rf"{LOCAL_USER_PATH}/outbox/?$", views.Outbox.as_view()),
|
re_path(
|
||||||
|
rf"{LOCAL_USER_PATH}/outbox/?$", views.Outbox.as_view(), name="user_outbox"
|
||||||
|
),
|
||||||
re_path(r"^\.well-known/webfinger/?$", views.webfinger),
|
re_path(r"^\.well-known/webfinger/?$", views.webfinger),
|
||||||
re_path(r"^\.well-known/nodeinfo/?$", views.nodeinfo_pointer),
|
re_path(r"^\.well-known/nodeinfo/?$", views.nodeinfo_pointer),
|
||||||
re_path(r"^\.well-known/host-meta/?$", views.host_meta),
|
re_path(r"^\.well-known/host-meta/?$", views.host_meta),
|
||||||
|
@ -46,9 +48,15 @@ urlpatterns = [
|
||||||
re_path(r"^opensearch.xml$", views.opensearch, name="opensearch"),
|
re_path(r"^opensearch.xml$", views.opensearch, name="opensearch"),
|
||||||
re_path(r"^ostatus_subscribe/?$", views.ostatus_follow_request),
|
re_path(r"^ostatus_subscribe/?$", views.ostatus_follow_request),
|
||||||
# polling updates
|
# polling updates
|
||||||
re_path("^api/updates/notifications/?$", views.get_notification_count),
|
|
||||||
re_path(
|
re_path(
|
||||||
"^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_string
|
"^api/updates/notifications/?$",
|
||||||
|
views.get_notification_count,
|
||||||
|
name="notification-updates",
|
||||||
|
),
|
||||||
|
re_path(
|
||||||
|
"^api/updates/stream/(?P<stream>[a-z]+)/?$",
|
||||||
|
views.get_unread_status_string,
|
||||||
|
name="stream-updates",
|
||||||
),
|
),
|
||||||
# authentication
|
# authentication
|
||||||
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
||||||
|
@ -149,7 +157,9 @@ urlpatterns = [
|
||||||
re_path(
|
re_path(
|
||||||
r"^invite-request/?$", views.InviteRequest.as_view(), name="invite-request"
|
r"^invite-request/?$", views.InviteRequest.as_view(), name="invite-request"
|
||||||
),
|
),
|
||||||
re_path(r"^invite/(?P<code>[A-Za-z0-9]+)/?$", views.Invite.as_view()),
|
re_path(
|
||||||
|
r"^invite/(?P<code>[A-Za-z0-9]+)/?$", views.Invite.as_view(), name="invite"
|
||||||
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^settings/email-blocklist/?$",
|
r"^settings/email-blocklist/?$",
|
||||||
views.EmailBlocklist.as_view(),
|
views.EmailBlocklist.as_view(),
|
||||||
|
|
|
@ -20,7 +20,7 @@ django-storages==1.11.1
|
||||||
django-redis==5.2.0
|
django-redis==5.2.0
|
||||||
|
|
||||||
# Dev
|
# Dev
|
||||||
black==21.4b0
|
black==21.4b2
|
||||||
pytest-django==4.1.0
|
pytest-django==4.1.0
|
||||||
pytest==6.1.2
|
pytest==6.1.2
|
||||||
pytest-cov==2.10.1
|
pytest-cov==2.10.1
|
||||||
|
|
Loading…
Reference in a new issue