diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py index 749049e35..a83b82518 100644 --- a/bookwyrm/models/shelf.py +++ b/bookwyrm/models/shelf.py @@ -59,6 +59,10 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): """can the shelf be safely deleted?""" return self.editable and not self.shelfbook_set.exists() + def get_remote_id(self): + """do not use slugs""" + return self.get_permalink() + def get_permalink(self): """shelf identifier instead of id""" base_path = self.user.remote_id diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 6ad7d65ab..fd8542780 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -439,21 +439,11 @@ urlpatterns = [ views.Shelf.as_view(), name="shelf", ), - re_path( - rf"^{USER_PATH}/(shelf|books)/(?P[\w-]+){regex.SLUG}/?$", - views.Shelf.as_view(), - name="shelf", - ), re_path( rf"^{LOCAL_USER_PATH}/(books|shelf)/(?P[\w-]+)(.json)?/?$", views.Shelf.as_view(), name="shelf", ), - re_path( - rf"^{LOCAL_USER_PATH}/(books|shelf)/(?P[\w-]+){regex.SLUG}/?$", - views.Shelf.as_view(), - name="shelf", - ), re_path(r"^create-shelf/?$", views.create_shelf, name="shelf-create"), re_path(r"^delete-shelf/(?P\d+)/?$", views.delete_shelf), re_path(r"^shelve/?$", views.shelve), diff --git a/bookwyrm/views/shelf/shelf.py b/bookwyrm/views/shelf/shelf.py index b92a79173..beeb70430 100644 --- a/bookwyrm/views/shelf/shelf.py +++ b/bookwyrm/views/shelf/shelf.py @@ -14,7 +14,7 @@ from django.views import View from bookwyrm import forms, models from bookwyrm.activitypub import ActivitypubResponse from bookwyrm.settings import PAGE_LENGTH -from bookwyrm.views.helpers import is_api_request, get_user_from_username, maybe_redirect_local_path +from bookwyrm.views.helpers import is_api_request, get_user_from_username # pylint: disable=no-self-use @@ -56,9 +56,6 @@ class Shelf(View): if is_api_request(request) and shelf_identifier: return ActivitypubResponse(shelf.to_activity(**request.GET)) - if r := maybe_redirect_local_path(request, shelf): - return r - reviews = models.Review.objects if not is_self: reviews = models.Review.privacy_filter(request.user)